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_ext_name

wgrib2: -set_ext_name


In the beginning, grib fields were identified by a name, a level and some timing information. Life was simple and the people were happy. This was soon to pass. A hoard of ensemble members appeared in the distance. A dust storm rolled in from the plains. The new power plants started putting sulfar dioxide into the air. All this had to added to the grib format. So names had to have modifiers, the percentile of some particulates of some chemical between size A and B microns. So wgrib2 added "extended names". So you could switch beween the old simpler names and the newer extended names.

Extended Names

The extended name includes modifiers like the ensemble information, dust information and probabilities. Optionally you can include the level and forecast information (wgrib2 v3.0.2+). More details are given here.


To select between the regular and extended name, you use
   -set_ens_name N
      N == 0                 default
      N == 1                 add misc terms like ensemble or probability
                               extension for wgrib2 v3.0.2+
      and(N,1) == 1          add misc terms like ensemble or probability
      and(N,2) == 2          add level information
      and(N,4) == 4          add forecast information
      ex N == 3              misc + level information
      ex N == 5              misc + forecast information
      ex N == 6              level information + forecast information
      ex N == 7              misc + level information + forecast information
      N > 7                  for future use

Extended Extended Names

The extended name facility was extended with wgrib2 v3.0.2 in order to fix a problem with converting grib to netcdf with some of the newer NCEP files. When wgrib2 writes netcdf files, the -netcdf concatinates the level information to the extended name to produce the netcdf name for the field. For some of the newer NCEP forecast files, this name wasn't unique. So the extended name needs to optionally include the forecast time information. With this extension, the level information was added as another option field to the extended name.

  $ wgrib2.v3.0.2 FCST.grb -set_ext_num 1 -netcdf
     lost fields because the field names were not unque

  $ wgrib2.v3.0.2 FCST.grb -set_ext_num 5 -netcdf
     extended name include misc-info and forecast-time-info.

The final modification to the extended name, was to make the field and space character a run-time parameter by the option, -set_ext_name_chars. The default values are '.' and '_' for backwards compatibilty. The modification was needed we now are seeing level-info and misc-info with periods in them like "0.5 mb".

-match, -if, and other string matches

The extended names also applies the match inventory. So string matches will have to be rewritten. Fortunately the process is mechanical.

  -match ":RH:"         ->     -match ":RH(:|.)"
  -match ":RH:500 mb:"  ->     -match ":RH(:|.)" -match ":500 mb:"
Many options use the extended name if enabled by -set_ext_name. For example, the -netcdf uses the extended name if enabled.


-sh-2.05b$ ./wgrib2 chem.grb2 -var
-sh-2.05b$ ./wgrib2 chem.grb2 -ext_name
-sh-2.05b$ ./wgrib2 chem.grb2 -set_ext_name 1 -ext_name
See also: -ext_name -set_ext_name_chars.

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, July 8, 2021.
Disclaimer Privacy Policy