Re: Computing yearly averages from monthly values

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue, 12 Dec 2006 17:32:00 -0700 (MST)

> My question is fairly simple. I have say a 3D matrix of the form X(nlat, nlon,
> 12) where nlat is the number of spacing along the latitude, nlon is the number
> of spacing along the longitudes and 12 is the number of months. So X has 12
> months of data for every lat, long grid. I want to compute the annual average
> over each lat, long grid to result in a matrix AnnAvg(nlat, nlon)
> I know I can do it using loops but was wondering if theres any function or
> short cut in doing this? I looked up the climatology functions but couldn't
> find any

There is a suite of dim_* and contributed.ncl dim_*Wrap functions.

I am not sure if you are using fortran or NCL ordering.
If it si NCL ordering ...

   XAVG = dim_avg_Wrap(x)

if it is fortran ordering and the array dimensions are named

   XAVG = dim_avg_Wrap(x(lat|:, lon|:, time|:))

If the dimensions are not named then name them and use above.

After computations use

   printVarSummary( XAVG )
   printMinMax( XAVG, True )

ncl-talk mailing list
Received on Tue Dec 12 2006 - 17:32:00 MST

This archive was generated by hypermail 2.2.0 : Wed Dec 13 2006 - 18:35:27 MST