Some useful climatology and regression functions

From: Chad Herman <chad.herman.us_at_nyahnyahspammersnyahnyah>
Date: Tue May 10 2011 - 00:21:24 MDT

I've been building some NCL functions to simplify calculations I do on a
daily basis. I often use CRUTEM's netCDf data and find it annoying that
there is a redundant dimension (t, unspecified, latitude, longitude).
That inspired me to write a function ("squeeze") that will strip out
redundant dimensions while preserving dimension names, coordinate
variables and meta data.

I also found that the current crop of climatology functions didn't do
what I needed. clmMonTLL will calculate the climatology, but I needed to
specify the minimum number of years to calculate a valid mean. I
sometimes deal with single time series which need to transformed into
anomalies. There's no function do that, so I was motivated to write my
own functions.

I've create two generic functions: clmMonTXXX and calcMonAnomTXXX.
Whether you have a single 1D time series (like station data), maybe an
irregular 2D time series (multiple stations), 3D like (time, lat, lon)
or 4D (time, lev, lat, lon), clmMonTXXX will inspect the input
variable's rank and figure out how to calculate the climatology. You can
specify how many years of data must be present to calculate a valid
mean. This function also updates (if necessary) variable attributes like
valid_min, valid_max or valid_range.

calcMonAnomTXXX will take a given 1D, 2D, 3D or 4D variable as well as
the result of clmMonTXXX and calculate anomalies. It will also update
the aforementioned meta data.

I needed more summary statistics in my linear regression calculations so
I wrote a regression function ("linreg") to return a lot more
information than regcoef and regline. I'm planning on extending this
function or creating a new one to accommodate multiple explanatory

I hope these functions find good use in the NCL community. If you
uncover any bugs or have useful suggestions, let me know. That's what
the "reply all" button is for.


ncl-talk mailing list
List instructions, subscriber options, unsubscribe:

Received on Tue May 10 00:21:35 2011

This archive was generated by hypermail 2.1.8 : Tue Aug 02 2011 - 14:31:37 MDT