This function does time averaging while applying a mask. The syntax is:
tmave(maskexpr,expr,timexpr1,timexpr2)where:
maskexpr
- the mask expression; when evaluated at a fixed time, it must give a single valueexpr
- the expression to be averagedtimexpr1,2  
- the limits of the time averaging domain
ave function,
except for the masking. Using tmave is much more efficient than using
maskout with
ave).
maskexpr at each fixed time.
maskexpr must yeild a single value. If this value
is the undefined/missing data value, then expr for
that time is not included in the average.
maskexpr is not the undefined data value, it is
used as the weight for expr in the average. So if
you define maskexpr accordingly, you can use the
tmave function to do weighted time averaging.
tmave is setting up
maskexpr. If expr is a grid
with X and/or Y and/or Z varying, then maskexpr
*MUST* refer to either a defined variable or a file with only time
varying. In general, you have to set up maskexpr
in advance.
slp over some time range
but only when sst over some region is above some value. You can
do this by:
set x 1 set y 1 set t 1 last define sstmask = aave(sst,lon=-180,lon=-90,lat=-20,lat=20) define sstmask = const(maskout(sstmask,sstmask-25.0),1)
Now sstmask is a time series where the value is 1 when
the sst areal average is above 25 and undefined when the
value is below 25. maskout set the values
below 25 to missing; const set the non-missing
values to 1. We can now do our tmave:
set lon -180 -90 set lat -20 20 set t 1 d tmave(sstmask,slp,t=1,t=last)
dset maskfilename xdef 1 linear 1 1 ydef 1 linear 1 1 zdef 1 linear 1 1 tdef 100 linear ....