
month_to_annual
Converts monthly values to annual values.
Prototype
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" ; This library is automatically loaded ; from NCL V6.2.0 onward. ; No need for user to explicitly load. function month_to_annual ( x : numeric, opt [1] : integer )
Arguments
xAn array containing monthly values. The 'temporal' dimension must be the leftmost dimension if there are multiple dimensions. The size of the 'temporal' dimension must be evenly divisible by 12.
optoption
opt=0 compute the unweighted sum of 12 values. opt=1 divide the unweighted sum by 12 to get the annual mean value(s)..
Return value
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. Note: Upon return the 'temporal' dimension will be named year to avoid confusing dimension names.
Description
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.
See Also
Examples
Example 1
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. The 'temporal' dimension will be named year.
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. The 'temporal' dimension will be named year.
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)