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
 

wgrib2: -set

Introduction

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

The -set option changes specific metadata of the in-memory grib (sub-)message. You need to save the messages to make them permanent. Expect the list of supported fields to expand as needed. There is some overlap between various -set_* options and the -set option. (Ex. -set_center N, and -set center N.) The -set option is the newer method. The -set option is used by the -set_metadata option.

Parameters that can be set

The available parameters that can be set will depend on the version of wgrib2 being used. To see the parameter available,

$ wgrib2 grib_file -set junk junk
*** FATAL ERROR: set asdf, allowed values: discipline, center, subcenter, master_table, 
local_table, background_process_id, analysis_or_forecast_process_id, aerosol_size, 
aerosol_wavelength, process, model_version_date, chemical, aerosol, table_1.2, table_1.3, 
table_1.4, table_3.0, table_3.1/GDT, table_3.2, table_3.3, table_3.4, table_4.0/PDT, 
table_4.1, table_4.2, table_4.3, table_4.5a, table_4.5b, table_4.6, table_4.7, table_4.8, 
table_4.10, table_4.11, table_4.230, table_4.233, table_5.0/DRT, table_6.0, %, cluster ***
"grib_file" has to be a grib file, and "junk" is any non-supported parameter.

Usage

-set X Y             X=field, Y=integer/float/long long int
                     depending on X

                     To find the values of X, use: wgrib2 - -set help all

Fields (as of wgrib2 v2.0.1)

  1. discipline or table_0.0 (fixed v2.0.5)
  2. center
  3. subcenter
  4. master_table or table_1.0
  5. local_table or table_1.1
  6. background_process_id
  7. analysis_or_forecast_process_id
  8. aerosol_size
  9. aerosol_wavelength
  10. process
  11. model_version_date
  12. chemical
  13. aerosol
  14. table_1.2
  15. table_1.3
  16. table_1.4
  17. table_3.0
  18. table_3.1 or GDT
  19. table_3.2
  20. table_3.3
  21. table_3.4
  22. table_4.0 or PDT
  23. table_4.1
  24. table_4.2
  25. table_4.3
  26. table_4.5a
  27. table_4.5b
  28. table_4.6
  29. table_4.7
  30. table_4.8
  31. table_4.10
  32. table_4.11
  33. table_4.230
  34. table_4.233
  35. table_5.0 or DRT
  36. table_6.0
  37. %
  38. cluster

Fields

  1. most are obvious and take an integer argument
  2. %: integer 0..100, percentage forecast
  3. model_version_date: YYYYMMDDHHmmss, for PDT 4.60 and 4.61

Example

$ wgrib2 IN.grb -set center 99 -center -grib OUT.grb
1:0:center=De Bilt, Netherlands
2:46042:center=De Bilt, Netherlands
3:63079:center=De Bilt, Netherlands
4.1:86046:center=De Bilt, Netherlands
...

-set center 99       sets the "center" to a value of 99 for current grib message (De Bilt)
-center              prints the value of "center"
-grib OUT.grb        writes the current grib message to OUT.grb
                     note: -grib uses the original compressesed grid values
		       -grib_out recompresses the grid values
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, April 13, 2018, April 8, 2021, Sep 2025
Disclaimer Privacy Policy