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 > wgrib -> wgrib2
 

wgrib -> wgrib2

Changed options

Converting scripts that use wgrib to wgrib2 should be straight forward.

       wgrib                             wgrib2

       -d all                            (no options)
       -d N                              -d N or -d N.M (for grib2 submessages)
       -bin -o FILE.BIN                  -bin FILE.BIN
       -text -o FILE.TXT                 -text FILE.TXT
       -ieee -o FILE.BIN                 -ieee FILE.BIN
       -grib -o FILE.GRIB                -grib FILE.GRIB
       -nh                               -no_header
       -h                                -header
       -verf (sets verf time flag)       -verf (write inventory with verf time)
       -s -verf                          -verf
       -V (verbose inventory)            -v (verbose) and use the following to get
                                             -grid (grid description)
                                             -bitmap (bitmap information)
                                             -stats (minumum/maximum value)
                                             -packing (to see packing information)
                                             -scan (to scan order)
       -PDS/-PDS10                       n/a
       -GDS/-GDS10                       n/a
       -ncep_opn/-ncep_rean              n/a
       -4yr                              n/a
       -ncep_ens                         n/a
       -p                                n/a
       -dwdgrib                          n/a
       -H                                n/a
       -o                                not needed
       -----                             -order ???? (grids are converted to we:sn order by default)
                                         use -order we:ns for GFS, nothing for NAM.

Changed inventory format, different searches

The wgrib2 inventory has changed. The various grep/egreps will have to be changed to see if they are compatible with new inventory format

works:
            wgrib  FILE | grep ":HGT:" | wgrib -i  FILE -bin -o FILE.BIN
            wgrib2 FILE | grep ":HGT:" | wgrib2 -i FILE -bin FILE.BIN
            wgrib2 FILE -bin FILE.BIN -match ":HGT:"

works:
            wgrib -4yr FILE | grep ":d=2006081712:" | wgrib -i  FILE -bin -o FILE.BIN
            wgrib2 FILE | grep ":d=2006081712:" | wgrib2 -i  FILE -bin -o FILE.BIN
            wgrib2 -match ":d=2006081712:" FILE -bin -o FILE.BIN

wgrib2 uses a 4 digit year code.  Scripts using 2 digit years need to modified.

convert:
            wgrib  FILE | grep ":d=06081712:" | wgrib -i  FILE -bin -o FILE.BIN
            wgrib2 FILE | grep ":d=2006081712:" | wgrib2 -i  FILE -bin -o FILE.BIN
            wgrib2 -match ":d=2006081712:" FILE -bin FILE.BIN

wgrib2 doesn't print out kdps5 .. kpds7 which are not applicable to grib2.

convert:
            wgrib  FILE | grep "kpds5=7:kpds6=100:kpds7=500:" | wgrib -i  FILE -bin -o FILE.BIN
            wgrib2 -match ":HGT:" -match ":500 mb:" -bin FILE.BIN FILE

grep/egrep

When you use wgrib, you end up using lots of greps. Many of the greps will have to be rewritten because the text has been altered (ex. "10 m above gnd" -> "10 m above ground"), are gone ("kpds5=6"), or replaced by a new format. GRIB2 is big compared with GRIB1 so things had to change. Generally the wgrib2 version use fewer abbreviations because it is easier to understand and line length is less of an issue with a flexiable inventory format.

Scan, Order of the Data

In wgrib, files were decoded in the "raw" order; i.e., the order that they were written. For most files the order was we:ns or we:sn. With GRIB2, the complexity of the order was increased. In order to make life easier for the user, wgrib2, by default, put the data in a we:sn order. (There is an option to put the data in a we:ns order.)

NOAA/ National Weather Service
National Centers for Environmental Prediction
Climate Prediction Center
5200 Auth Road
Camp Springs, Maryland 20746
Climate Prediction Center Web Team
Page last modified: May 15, 2005
Disclaimer Privacy Policy