Skip Navigation Links 
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-set_byte

wgrib2: -set_byte


The -set_byte option set the values of selected octets/bytes in the current grib message. For example if you want to set octet 20 and 21 (byte in WMO speak) of section 4 to zero and one, you would use -set_byte 4 20 0:1. The first argument is the section number. The second is the byte (octet) number starting from 1 (consistent with WMO documentation) and the third a colon separated list of values.

After you have altered the grib message, you can save the message by either -grib or the -grib_out. You need to use the latter option if the grid values were altered because the data section needs to be updated.


SECTION=0 .. 7
I = integer between 0 and 255


$ wgrib2 f.grb2
1:0:d=2008120200:TMP:800 mb:anl:
$ wgrib2 f.grb2 -set_byte 0 7 3
1:0:d=2008120200:SRAD:800 mb:anl:
In the above example, the dicipline is changed to 3.

See also:

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