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_date
 

wgrib2: -set_date

Introduction

The -set_date option changes the reference date of the in-memory grib (sub-)message. You can write out the message with the new date by the -grib option. If you use -grib_out option to write out the changed grib message, you will write the grib message with the compression method and precision that is in effect at the time. This is slower and may lose precision. Of course if the in-memory grid values have been modified, you have to use the -grib_out.

The option -set_date X sets the reference time to "date code" X, where X is YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm or YYYYMMDDHHmmSS. (YYYY=year, MM=month, DD=day, HH=hour, mm=minute, SS=second) If MM/DD/HH/mm/SS is missing, the original MM/DD/mm/SS is unaltered.

You can change the reference time by an offset. To change the reference time by an offset, the argument has to start with either a negative sign or positive sign, followed by an integer and ending with a units (hr,dy,mo or yr). Note: minutes abreviation "mn" can be easily confused as the abreviation for month, so hasn't been implemented. When a minute offset is needed, I will add it to wgrib2.

Usage

-set_date  X           X = reference time, usually starting date
                       X=YYYY, YYYYMM, YYYYMMDD, YYYYMMDDHH, YYYYMMDDHHmm or YYYYMMDDHHmmSS
                       YYYY=year, MM=month, DD=day, HH=hour, mm=minute, SS=second
                       if MM/DD/HH/mm/SS is missing, the original MM/DD/mm/SS is unaltered

-set_date -N(units)    negative offset (wgrib2 v2.0.5+)
-set_date +N(units)    positive offset (wgrib2 v2.0.5+)
                       N = positive integer
                       units = hr, dy, mo or yr  (GrADS time units for hour, day, month and year)
                        note: current code does not support mn, the minutes
                        units code.  (Trivial change)  The mn units can be 
                        confused with mo and I will add the mn units only 
                        when minutes is a common unit.

Example

$ wgrib2 png.grb2
1:4:d=2009060500:RH:2 m above ground:330 hour fcst:ens std dev
$ wgrib2 png.grb2 -set_date 20180101 -grib OUTFILE -s
:4:d=2018010100:RH:2 m above ground:330 hour fcst:ens std dev
$ wgrib2 png.grb2 -set_date +12hr -grib OUTFILE -s
1:4:d=2009060512:RH:2 m above ground:330 hour fcst:ens std dev
$ wgrib2 png.grb2 -set_date -12hr -grib OUTFILE -s
1:4:d=2009060412:RH:2 m above ground:330 hour fcst:ens std dev

Note: wgrib2 png.grb2 -set_date -12hr -grib OUTFILE -s 
has a different inventory than
      wgrib2 png.grb2 -s -set_date -12hr -grib OUTFILE
because the latter prints the inventory before the date has been modified.
Note: wgrib2 png.grb2 -set_date -12hr -grib OUTFILE is the same as
      wgrib2 png.grb2 -set_date -12hr -grib OUTFILE -s 
because wgrib2 will add a "-s" to the command line when it detects
that the command line has no inventory options.
See also: -grib, -grib_out, -s, -t, -T,

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: March 10, 2016, July 2, 2018
Disclaimer Privacy Policy