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_var

wgrib2: -set_var


Please see new grib for the basic concepts of making new grib files.

The -set_var option changes the variable name of the in-memory grib (sub-)message. You can write out the message with the new name by the -grib (fast) and -grib_out (slow) options. Of course if the in-memory grid values have changed, you have to use the latter option.


-set_var X              X=valid grib variable name such as HGT or TMP


$ wgrib2 p.grb
1:0:d=2009072100:PRES:mean sea level:anl:
$ wgrib2 p.grb -set_var TMP -grib out.grb
1:0:d=2009072100:TMP:mean sea level:anl:
$ wgrib2 out.grb
1:0:d=2009072100:TMP:mean sea level:anl:
The -set_var option will rename all the fields in a grib file. If you only want to rename specific fields, you will have to use the -if and -fi options. See also: -fi, -grib, -grib_out, -if -set_metadata

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