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

wgrib2: -ave_var


The -ave_var option is based on the -ave option. In addition to computing the mean, the -ave_var option computes the sample standard deviation, minimum and maximum values for each grid point. Welford's method for computing the mean and variance was used because it is a one-pass scheme with the accuracy of a two-pass algorithm.

The options and expected sequence of fields is the same as with the -ave option.


-ave_var (time interval)  (output grib file)
   time interval = (integer)(units)
   (units) = hr, dy, mo, yr


$ wgrib2 pgblnl.gdas.201302 -match ":UGRD:200 mb:" -ave_var 6hr out
141:1170314:d=2013020100:UGRD:200 mb:anl:
659:5936420:d=2013020106:UGRD:200 mb:anl:
1177:10703131:d=2013020112:UGRD:200 mb:anl:
1695:15432277:d=2013020118:UGRD:200 mb:anl:
$ wgrib2 out
1:0:d=2013020100:UGRD:200 mb:112@6 hour ave(anl),missing=0:
2:13343:d=2013020100:UGRD:200 mb:112@6 hour StdDev(anl),missing=0:
3:24058:d=2013020100:UGRD:200 mb:112@6 hour min(anl),missing=0:
4:37401:d=2013020100:UGRD:200 mb:112@6 hour max(anl),missing=0:
Making a GrADS control for "out" requires editing the ctl file to shorten the names of variables.
$ alt_g2ctl -0t out > out.ctl
$ vi out.ctl
.. edit out.ctl so the last 6 lines look like this
vars 4
UGRDdev 0 0 "UGRD:112@6 hour StdDev(anl),missing=0:200 mb" * 200 mb U stddev
UGRDave 0 0 "UGRD:112@6 hour ave(anl),missing=0:200 mb" * 200 mb U ave
UGRDmax 0 0 "UGRD:112@6 hour max(anl),missing=0:200 mb" * 200 mb U max
UGRDmin 0 0 "UGRD:112@6 hour min(anl),missing=0:200 mb" * 200 mb U min
$ alt_gmp out.ctl
wgrib2_flags=-npts -set_ext_name 1 -T -ext_name -ftime -lev
dtype:  dtype grib2
tdef:  nt=1 start=00Z01feb2013 by=1mo
zdef: nlevel=1
resolve_dsets dset=out inctime=1mo
resolve_dsets: no template
scanning out (process=0)
merge index files
writing out index
/export/cpc-lw-webisuzak/wd51we/bin/alt_gmp v0.0.5 finished ctl=out.ctl records matched=4, not matched=0 ctl_defn=4

See also: -ave

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: Jan 25, 2017
Disclaimer Privacy Policy