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-set_var
 

wgrib2: -set_var

Introduction

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.

You can set the name to a locally defined variable name only if the center is set correctly. For example, you can use an NCEP-defined variable name only if the center is already defined as NCEP. If the center is undefined, you cannot use any locally defined names.

The search order is for WMO definitions and then the locally defined definitions. The search order has implications for NCEP users. NCEP often have WMO and NCEP definitions for the same variable name/type. The -set_var option will choose the WMO definition. This will cause problems with programs that expect the NCEP definition.

The -set_var option will alter the master table. The grib2 standard says that variable definitions are only valid for specified master tables. Wgrib2 keeps track of range of tables for which each variable name is valid. In addition, there is an entry for the master table used by the -set_var option.

Usage

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

Example

$ 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: April 28, 2017
Disclaimer Privacy Policy