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 is used to copy an entire GRIB2 message (including all the submessages) to a specified file. This is useful if you want to preserve to keep the submessages. This is in contrast to the -grib option which writes submessages into its own grib message.

The -GRIB option should only be used to copy the original grib message to another file. Unlike the the -grib option, changing the metadata is not recommended.

Usage

-GRIB file_name

Example

The grib standard allows arbitrary data between grib messages. Sometimes one want to remove this "junk" and only keep the grib messages. For grib files with no submessages, the cleaning operation is simple.

$ wgrib2 IN.grb -grib OUT.grb
For files with grib submessages, the cleaning can be done by,
$ wgrib2 IN.grb -if "^[0-9]*(\.1:|:)" -GRIB OUT.grb                all versions of wgrib2
$ wgrib2 IN.grb -if "^[0-9]*(\.1:|:)" -GRIB OUT.grb -endif         wgrib2 v3.0.0+

-if "^[0-9]*(\.1:|:)"  matches message number XXX or XXX.1, single grib message or first grib submessage
-GRIB                  write grib message including any submessage
See also: -grib -ncep_uv -submsg -tosubmsg -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, Sep 5, 2023
Disclaimer Privacy Policy