Skip Navigation Links www.nws.noaa.gov 
NOAA logo - Click to go to the NOAA home page National Weather Service   NWS logo - Click to go to the NWS home page
Climate Prediction Center
 
 

 
About Us
   Our Mission
   Who We Are

Contact Us
   CPC Information
   CPC Web Team

 
HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2: user grib2tables
 

wgrib2: user grib2tables

Introduction

Grib2 messages have variable names such as HGT or TMP. The table built into wgrib2 can be agumented using "user defined grib tables". This allows you to add locally defined variables as well, update the grib table, and change the names of pre-existing variables. Wgrib2 looks for the user defined gribtable in (in order of search)

   environment varible: GRIB2TABLE
   environment varible: grib2table
   file: grib2table (in current working directory)

   Assuming your user definitions are in a file called "/home/my_name/my_grib2table"

   for sh/bash
     export GRIB2TABLE=/home/my_name/my_grib2table
   and for people who have a broken caps lock key
     export grib2table=/home/my_name/my_grib2table

   for csh
     setenv GRIB2TABLE /home/my_name/my_grib2table
   or
     setenv grib2table /home/my_name/my_grib2table

   You can also always put the user defined gribtable in the "grib2table" in 
   the "current working directory".

The user defined gribtable is searched before the built-in gribtable.

Format of the user defined gribtable

   Comments
       start with the first column staring with #, *, !
       any line that is not a definition line

   definitions:
       I1:I2:I3:I4:I5:I6:I7:I8:NAME:DESC:UNITS
       I1=discipline
       I2=master table set: used when using -set_var
       I3=master table low:
       I4=master table high:   (defintion valid for low <= mastertable <= high)
       I5=center
       I6=local table number
       I7=parameter category (code table 4.1)
       I8=parameter (code table 4.2)

       when a field is not used, use a value of -1

   all other lines are not used.  Warnings will be given when the number of colons suggest an error. 

For each variable, there is a master table set, low and high. The master table is a master version number. Each definition has a range of version numbers for which it is recognized. If you want the variable to defined for all version numbers, set "low" to zero and "high" to some large positive integer. The "set" value is master table number used when the "-set_var" option is used change the variable name.

Sample grib2table

/*
 * sample user grib table
 */
/*

  struct gribtable_s {
    int disc;   /* Section 0 Discipline                                */
    int mtab_set;    /* Section 1 Master Tables Version Number used by set_var      */
    int mtab_low;    /* Section 1 Master Tables Version Number low range of tables  */
    int mtab_high;   /* Section 1 Master Tables Version Number high range of tables */
    int cntr;   /* Section 1 originating centre, used for local tables */
    int ltab;   /* Section 1 Local Tables Version Number               */
    int pcat;   /* Section 4 Template 4.0 Parameter category           */
    int pnum;   /* Section 4 Template 4.0 Parameter number             */
    const char *name;
    const char *desc;
    const char *unit;
  };

*/
0:1:0:10:8:0:190:190:TEST1:Critcal Fire Weather:??
0:1:0:10:8:0:190:191:TEST2:Dry lightning:??
0:1:0:10:0:0:2:2:Utest:utest:m/s

Uses

  1. update tables with new or local variables
  2. convert the variable names to another convention, language
  3. change the variable names that are produced by g2ctl
  4. in the conversion to netcdf, you may want a different set of variable names

Caution

The user-defined grib tables allow you to use your own names for variables. However, you have to be careful. Suppose you want to define a new variable name and you didn'r realize the name was already defined for another variable. Then the inventory could be confusing and the results of -set_var would unpredictable.

The option, -ncep_uv, combines the UGRD and VGRD fields into one grib message. This option will not work when UGRD and VGRD are renamed.

The option, -new_grid, does vector interpolation of vector fields and scalar interpolation on the other fields fields. The -new_grid option will not identify the vector fields if their names get changed and scalar interpolations will be used. The identification of maxx and wind fields in the Arakawa E grid will also not work.


NOAA/ National Weather Service
National Centers for Environmental Prediction
Climate Prediction Center
5830 University Research Court
College Park, Maryland 20740
Climate Prediction Center Web Team
Page last modified: May 15, 2005
Disclaimer Privacy Policy