Re: [idvusers] Formula to compute anomalies

  • To: Joseph Maina <jmaina@xxxxxxx>
  • Subject: Re: [idvusers] Formula to compute anomalies
  • From: Tom Whittaker <whittaker@xxxxxxxx>
  • Date: Tue, 11 May 2010 09:42:16 -0500
In the System Jython library, under "Grid routines" is a function
called "oldaverageOverTime()" -- you could modify this (by copying it
to the Local Jython/User library and editing it) to compute the
cumulative sum.   (I'm assuming here that you already know how to do
the first part of your computation -- that of computing the
anomalies).

Since you want a running sum of only positive values, another approach
would be to use the built-in sumOverTime() function, but zero-out the
array elements that are less than 0 before you do that...for example:

inx = find(field, "<",0.0)
replace(field, inx, 0.0)

(the "find()" function returns an int[] array with the indecies where
the comparison is 'true').  You could also use the "mask()" function
and then multiply the returned field by the original one.  Note that
these functions only work on a single time, so you would have to loop
over times, using the first index of the "field" as the time index,
most likely.

Hope that helps.

tom

On Tue, May 11, 2010 at 4:03 AM, Joseph Maina <jmaina@xxxxxxx> wrote:
> Hi List, I intend to compute temperature anomalies of a long time series by
> taking the difference between each time step  in a monthly mean time series
> and the temperature anomaly (single grid). The output would be a time series
> of this difference (anomalies), which I would then compute a cumulative sum
> of only the positive anomalies, more like the current inbuilt sum over time
> steps formula but in this case only the positive anomalies would be
> summed..any help would be much appreciated. Thanks
> Maina
> _______________________________________________
> idvusers mailing list
> idvusers@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, visit: 
> http://www.unidata.ucar.edu/mailing_lists/
>



-- 
Tom Whittaker
University of Wisconsin-Madison
Space Science & Engineering Center (SSEC)
Cooperative Institute for Meteorological Satellite Studies (CIMSS)
1225 W. Dayton Street
Madison, WI  53706  USA
ph: +1 608 262 2759



  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the idvusers archives: