As noted by Kyle, if you have a vertical coordinate variable
then you can use the "natural coordinates" via {...}.
I do not have a copy of the file you are using. The file I have
is named: gblav.T00Z.PGrbF03.grb
--- The 1st rule of data processing is to *always* look at your data file(s). %> ncl_filedump gblav.T00Z.PGrbF03.grb | less [snip] float UGRD_P0_L103_GLL0 ( lat_0, lon_0 ) center : US National Weather Service - NCEP (WMC) production_status : Operational products long_name : U-component of wind units : m s-1 _FillValue : 1e+20 grid_type : Latitude/longitude parameter_discipline_and_category : Meteorological products, Momentum parameter_template_discipline_category_number : ( 0, 0, 2, 2 ) level_type : Specified height level above ground (m) level : 10 forecast_time : 3 forecast_time_units : hours initial_time : 02/03/2012 (00:00) [snip] Note the "level" *attribute*. In this case, You can read the 10m level directly. f = addfile("gblav.T00Z.PGrbF03.grb", "r") u10 = f->UGRD_P0_L103_GLL0 --- You can also use NCL's grib file options. The following forces NCL the include what it considers 'degenerate dimensions' (array size 1) to be included. In the above, the level dimension is of size one so it is a degenerate dimension. setfileoption("grb","SingleElementDimensions","level") f = addfile("gblav.T00Z.PGrbF03.grb", "r") u = f->UGRD_P0_L103_GLL0 printVarSummary(u) Variable: u Type: float Total Size: 1039680 bytes 259920 values Number of Dimensions: 3 Dimensions and sizes: [lv_HTGL16 | 1] x [lat_0 | 361] x [lon_0 | 720] Coordinates: lv_HTGL16: [10..10] <******************** Note lat_0: [90..-90] lon_0: [ 0..359.5] Number Of Attributes: 12 center : US National Weather Service - NCEP (WMC) production_status : Operational products long_name : U-component of wind units : m s-1 _FillValue : 1e+20 grid_type : Latitude/longitude parameter_discipline_and_category : Meteorological products, Momentum parameter_template_discipline_category_number : ( 0, 0, 2, 2 ) level_type : Specified height level above ground (m) forecast_time : 3 forecast_time_units : hours initial_time : 02/03/2012 (00:00) Here you could use the {...} because there is a 'coordinate variable' named 'level' u10 = u({10},:,:) or, directly u10 = f->UGRD_P0_L103_GLL0({10},:,:) printVarSummary(u10) On 5/31/12 5:52 AM, Kyle Griffin wrote: > Christelle, > > To reference a specific value of a coordinate array, you need to place > the coordinate in curly braces. This tells it to look for the value of > that coordinate variable instead of the index of that coordinate > variable. In your case, the vertical coordinate of the XXXX_P0_L103_GLL0 > variables are (/10,80,100/) - so what you do right now is try and refer > to the 11th index of that 3-value array, which is clearly out of bounds. > You'll want to change your statements to look like: > > UGRD_P0_L103_GLL0({10},:,:) > VGRD_P0_L103_GLL0({10},:,:) > > To read more on the variable subscripting, see this section of the NCL > Language Guide: > http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml > > > Kyle > ----------------------------------------------------- > Kyle S. Griffin > Dept. of Atmospheric and Environmental Sciences > University at Albany, SUNY > 1400 Washington Ave, Albany, NY 12222 > Office: ES-218 Email: kgriffin@albany.edu <mailto:kgriffin@albany.edu> > http://www.atmos.albany.edu/student/kgriffin/ > > > > On Thu, May 31, 2012 at 4:37 AM, Christelle LACROIX <cl@meteoconsult.fr > <mailto:cl@meteoconsult.fr>> wrote: > > Hi, > > > I tried to plot wind 10m above ground from gfs datas, i > use UGRD_P0_L103_GLL0 and VGRD_P0_L103_GLL0, but when i write > > UGRD_P0_L103_GLL0(10,:,:) > VGRD_P0_L103_GLL0(10,:,:) > > i have some errors > > /datas/grib/gfs/18/gblav.T18Z.PGrbF06.grb > Copyright (C) 1995-2011 - All Rights Reserved > University Corporation for Atmospheric Research > NCAR Command Language Version 6.0.0 > The use of this software is governed by a License Agreement. > See http://www.ncl.ucar.edu/ for more details. > warning: Entry (224) not found in code table file > /usr/local/src/ncl/lib/ncarg/grib2_codetables/ncep/4/4.2.0.2.table > warning: NclGRIB2: codetable file > "/usr/local/src/ncl/lib/ncarg/grib2_codetables/ncep/4/4.2.2.4.table" > not a valid GRIB2 code table. > warning: Entry (2) not found in code table file > /usr/local/src/ncl/lib/ncarg/grib2_codetables/ncep/4/4.2.table > fatal:Subscript out of range, error in subscript #0 > > > Do you have an idea to help me , please? > > > Thanks > > CL > > > > _______________________________________________ > ncl-talk mailing list > List instructions, subscriber options, unsubscribe: > http://mailman.ucar.edu/mailman/listinfo/ncl-talk > > > > > _______________________________________________ > ncl-talk mailing list > List instructions, subscriber options, unsubscribe: > http://mailman.ucar.edu/mailman/listinfo/ncl-talk _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Thu May 31 08:05:00 2012
This archive was generated by hypermail 2.1.8 : Wed Jun 06 2012 - 15:17:44 MDT