Re: GRIB2 Variable Names

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue, 18 Aug 2009 13:18:11 -0600

Hi David,

PyNIO decodes GRIB 2 files based on a set of tables contained in text
files that are read at runtime. The naming scheme is described in
detail at:
http://www.pyngl.ucar.edu/NioFormats.shtml#GRIB.
The point of the naming scheme is not to be obscure but is to allow
the collection of like GRIB records into array variables with time
and level dimensions in addition to the horizontal dimensions
contained in each individual GRIB record. The names are intended to
uniquely distinguish the variables using information such as level
type and grid type. It is true that the names change somewhat from
GRIB 1 to GRIB 2. This is a necessary consequence of the differences
between the GRIB 1 and 2 formats.

You do not specify what GFS files you are using, but I just
downloaded a sample GFS file from http://nomad3.ncep.noaa.gov/pub/gfs/
rotating-grb2. (gfs.t00z.pgrbf00.grib2). I was able to locate a
'total cloud cover' field within it. I found this by manually
searching through the output of

f = Nio.open_file('gfs.t00z.pgrbf00.grib2')
print(f)

....
       float TCDC_P0_L244_GLL0 [ lat_0, lon_0 ]
          center : US National Weather Service - NCEP (WMC)
          production_status : Operational products
          long_name : Total cloud cover
          units : %
          _FillValue : 1e+20
          grid_type : Latitude/longitude
          parameter_discipline_and_category : Meteorological
products, Cloud
          parameter_template_discipline_category_number : [0,
0, 6, 1]
          level_type : Convective cloud
          level : 0
          forecast_time : 0
          forecast_time_units : hours
          initial_time : 08/18/2009 (00:00)
...

One could, of course, search on the 'long_name' attribute to find
this variable programatically.

However, it is true that some of the tables are a bit out of date. If
our tables do not contain an entry for a particular parameter you
will get a error message such as this:

warning: Entry (203) not found in code table file /usr/local/lib/
python2.6/site-packages/PyNIO/ncarg/grib2_codetables/ncep/
4/4.2.2.3.table

If the parameter is not found in the tables, PyNIO still creates a
variable with the prefix 'VAR':

       float VAR_2_3_203_P0_L1_GLL0 [ lat_0, lon_0 ]
          center : US National Weather Service - NCEP (WMC)
          production_status : Operational products
          long_name : unknown variable name
          units : unknown
          _FillValue : 1e+20
          grid_type : Latitude/longitude
          parameter_discipline_and_category : Land surface
products, Mass
          parameter_template_discipline_category_number : [0,
2, 3, 203]
          level_type : Ground or water surface
          level : 0
          forecast_time : 0
          forecast_time_units : hours
          initial_time : 08/18/2009 (00:00)

In this case, if you go to the NCEP GRIB2 documentation, the error
message gives you enough information to figure out what the variable
is. From
http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-2-2-3.shtml,
you can see that parameter 203 is 'Field Capacity', with units of
'fraction'. If you are ambitious enough you could modify the
appropriate table to contain this information. But note that we are
intending to update our GRIB 2 tables in the very near future.

It is less likely, though possible, that some records are entirely
unaccounted for in the PyNIO presentation of the file. If you think
this is the case with the files you are using, please let us know how
to get some sample data that demonstrates the problem. A pointer to a
site where we can get the data on-line would be great. Otherwise, we
can make arrangements for you to upload the file(s) to an ftp server.
  -dave

On Aug 18, 2009, at 6:06 AM, David Brodrick wrote:

> Greetings,
> I have recently moved from processing GFS forecasts in grib1 format to
> grib2.
>
> I have checked with Jordan Alpert at NOAA and he says the grib2 files
> contain all of the same data as the grib1 files - however I cannot
> figure out what the variables are called. AFAIK NIO generates the
> variable names based on some algorithm, so I think my question is
> an NIO
> question and not a GFS question(?).
>
> It seems to me that when I run..
> f=Nio.open_file(i)
> for j in f.variables:
> print f.variables[j]
> ..that not all of the variables actually contained in the grib2
> file get
> printed.
>
> Specifically I am trying to work out what the variable for total cloud
> cover over all layers in the atmosphere is called, but I think that
> other fields also appear to be missing but are actually in there.
>
> Many thanks for your advice or direction.
> Cheers,
> David
>
>
>
> _______________________________________________
> pyngl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk

_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Tue Aug 18 2009 - 13:18:11 MDT

This archive was generated by hypermail 2.2.0 : Mon Aug 24 2009 - 11:15:58 MDT