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

wgrib2: -grib

Introduction

The -grib option writes the data in GRIB-2 format. This option only writes the current field (record/submessage) if the GRIB message contains multiple fields (records/submessages). If you want to copy the entire GRIB-2 message, use the -GRIB option.

-grib vs. -grib_out

These two options do similar things, they write a grib message to a specified file. The -grib writes the grib message and -grib_out option takes the decoded grib message, converts it back into grib2 and then writes it out. Obviously the latter option is much slower. You only use -grib_out when you have modified the data (grid) values. For example, you may have set many of the points to undefined in order to the data volume. Since the data values have changed, you have to use the -grib_out in order to create the smaller grib file.

Usage

-grib file_name

Example

The slow way of extracting 2 meter RH to rh.grb.  (Read test.grb2 twice.)
$ wgrib2 test.grb2 -s | grep ":RH:2 m above ground:" | wgrib2 -i test.grb2 -grib rh.grb
285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst

The fast way of extracting 2 meter RH to rh.grb.  (Read test.grb2 once.)
$ wgrib2 test.grb2 -match ":RH:2 m above ground:"  -grib rh.grb
285:36796469:d=2005090200:RH:2 m above ground:60 hour fcst

See also: -GRIB, -grib_out -append


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 Aug 10, 2020
Disclaimer Privacy Policy