Converts monthly values to annual values.
Available in version 4.2.0.a033 and later.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" function month_to_annual ( x : numeric, opt  : integer )
An array containing monthly values. The "time" dimension must be the leftmost dimension if there are multiple dimensions. Ideally, the size of the "time" dimension is evenly divisible by 12.opt
opt=0 compute the unweighted sum of 12 values. opt=1 divide the unweighted sum by 12 to get the annual mean value(s)..
Returns an array where the "time" dimension is decimated by a factor of 12. If any month is missing (_FillValue) for an individual year a missing value is returned.
Typical usage is that an array of monthly precipitation totals (e.g., mm) or monthly mean temperatures are input. For precipitation, generally opt=0, and the sum of the 12 values is returned. For temperature, generally opt=1, and the (unweighted) annual average is returned. All months must be present for an annual value to be computed; else, a _FillValue for that year.
A one-dimensional array of monthly precipitation totals [mm] is to be converted to an annual total. If prc(time), and the size of time is 240 monthly values, than 20 (=240/12) values (years) will be returned.
prc_annual_total = month_to_annual(prc, 0) ; prc_annual_total(20)If the array contains, say, monthly mean temperatures (tmp), then
tmp_annual_mean = month_to_annual(tmp, 1) ; tmp_annual_mean(20)Example 2
A multi-dimensional array of monthly precipitation totals [mm] is to be converted to an annual total. If prc(time,lat,lon), and the size of time is 1200 monthly values, than 100 (=120/12) values (years) will be returned.
PRC = month_to_annual(prc, 0) ; PRC(100,nlat,mlon)If the array contains, say, monthly mean temperatures [tmp(time,lev,lat,lon)], then
TMP = month_to_annual(tmp, 1) ; TMP(100,klev,nlat,mlon)