I know there must be a straightforward way to combine some of the
existing Jython time series functions to do this, but I can't seem to
figure it out: I have a time series of monthly temperature anomaly
readings (over a global 2-D grid) in the parameter TREFHT and want to
derive from this a new parameter TREFAVG that contains (at each point
on the grid) the 12-month moving average. For example, if the temp
anomaly over Chicago was
then I need TREFAVG for the grid cell over Chicago in December to
contain 0.33 (=sum(Jan-Dec)/12)). That same cell for Jan would contain
I'm guessing the general strategy should be to define a new Jython
function that calculates the average of the current value plus the
preceding 11, then to use the applyToRange function to run it on the
entire data series. But despite combing through the User's Guide
section on the Jython Library and searching for relevant code
examples, I can't seem to figure out the right syntax.
Any pointers would be most appreciated!