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 > wgrib2: submessages
 

Submessages in wgrib2

In GRIB-1, each field was in its own record or message. Each message was a self-contained enity. With GRIB-2, a message can contain a multiple of fields or submessages. Why would someone add such a feature? I figure that some people like to be organized. Put all the temperatures into a message, put all the winds into another message and the heights into a third message. It then becomes easy to "grab" all the temperature data. Of course, if just want the data at 500 hPa, you are out of luck.

How does wgrib2 handle submessages

When you want an inventory of the file, you want to see all the fields. If you want to extract the 500 hPa heights, you doesn't care whether it is in a submessage. The only difference when using wgrib2 is that record number may have decimal point and the submessage number if needed. Most of the time, one can igore whether the data are in submessages.

In this wgrib2 inventory, the data are in one message with four submessages.

1.1:0:d=2000070312:HGT:500 mb:24 hour fcst
1.2:0:d=2000070312:TMP:850 mb:24 hour fcst
1.3:0:d=2000070312:UGRD:850 mb:24 hour fcst
1.4:0:d=2000070312:VGRD:850 mb:24 hour fcst

In this wgrib2 inventory, the data are in four messages.

1:0:d=2000070312:HGT:500 mb:24 hour fcst
2:114221:d=2000070312:TMP:850 mb:24 hour fcst
3:195862:d=2000070312:UGRD:850 mb:24 hour fcst
4:277503:d=2000070312:VGRD:850 mb:24 hour fcst

For either file, we can do

wgrib2 grib2_file | grep ":HGT:500 mb:" | wgrib2 grib2_file -i -text -o z500.txt

Wgrib2 "ignores" the submessage feature and makes the the file look and handle like a file without submessages. However, there are two options that allow you to preserve the "submessage" character of the original grib file. The option "-GRIB" writes out the entire grib message including all submessages. The companion option "-submsg N", only allows inventory processing of submessage N. (Usually N is set to one.)


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