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

wgrib2: -inv


The -inv option redirects the inventory to a file. This option could be used with an option to send decoded data to STDOUT.

$ wgrib2 file -inv my.inv -text - -no_header  -match ':HGT:500 mb:' |  JOB

  -inv my.inv   writes the inventory to my.inv
  -text -       write the decoded data as a text file to stdout
  -no_header    no header
  JOB           is some program that reads the raw data from stdin

The -inv option is similar but different from saving stdout.

$ wgrib2 file -inv my.inv
$ wgrib2 file >my.inv2

In the above example, my.inv and my2.inv will be the same. However, wgrib2 can be used as a grib filter. In this case, grib data is read from stdin and written to stdout.

$ cat FILE1 FILE2 | wgrib2 - -match ':HGT:500 mb:' -grib - -inv /dev/null | \
   wgrib2 - -new_grid_winds earth -new_grid ncep grid 3 newgrd.grb

The -inv option is very specialized and helps when you want to imbed wgrib2 within another program. For example, reading a grib2 record from within perl program is easy.

  open(DATA, "wgrib2 file -inv /dev/null -text - -no_header -match ':HGT:500 mb:' |");


-inv FILE
See also: -text -bin

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, updated 11/2019
Disclaimer Privacy Policy