Re: 3hrly to monthly function?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed May 26 2010 - 07:33:01 MDT

Hi Anji

The function is located in "contributed.ncl"

You can readily examine the function:

%> less $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl

Then search for "calculate_monthly_values"

I have extracted the comments:
=======================================
undef ("calculate_monthly_values")
function calculate_monthly_values (x:numeric, arith:string,
nDim[1]:integer, opt[1]:logical)

; calculate monthly values [avg, sum, min, max]
; x: numeric array of 5D or less [eg: time,lev,lat,lon]
; *must* have time coordinate recognized by ut_calendar
; if 5D [case,time,lev,lat,lon]
; arith: "avg" [also, "ave"], "sum","min","max" others may be added
later
; nDim : scalar integer that specifies the 'time' dimension [generally, 0]
; opt : option ... not used here
;
; Sample usage: x(time,lat,lon) where time are n-hrly or daily values.
; xMonthAvg = calculate_monthly_values(x, "avg", 0, False)
; xMonthSum = calculate_monthly_values(x, "sum", 0, False)
; xMonthMin = calculate_monthly_values(x, "min", 0, False)
; xMonthMax = calculate_monthly_values(x, "max", 0, False)
;
==========================================

Good luck
D

On 5/26/10 5:55 AM, Anji Seth wrote:
> Hello NCL People,
>
> I found in the archives that Dennis has an unsupported function to
> calculate_monthly_values of a variable from 3hourly or daily values,
> and that the time grid must be recognized as UT.
>
> I'm trying this calculation on climate model data from a netcdf file
> that has time units in hours since
> 010100 1968, so I think the time grid should be OK?
>
> Below is what Dennis had written.
> 1. My first question: how is nDim used? It says "should generally be
> zero"
> Do I need to specify this for 3-hourly data, or does the function get
> this from the time grid?
>
> 2. Is something special required to use the function? (e.g. I have
> Dennis' utilities and contrib loaded).
>
> Thanks in advance for your help!
> Best, -Anji
>
> From: Dennis Shea<shea_at_nyahnyahspammersnyahnyah> Date: Mon Feb 22
> 2010 - 11:21:41 MST
>
> Attached is an unsupported function:
>
> calculate_monthly_values
>
> Note the the "time" coordinate variable associated
>
> with the variable "x" must be recognized via "ut_calendar"
>
> ;---------------------------------
>
> ; undocumented
>
> ;
>
> undef ("calculate_monthly_values")
>
> function calculate_monthly_values (x:numeric, arith:string,
>
> nDim[1]:integer, opt
>
> [1]:logical)
>
> ; calculate monthly values [avg, sum, min, max]
>
> ; x: numeric array of 4D or less [eg: time,lev,lat,lon]
>
> ; *must* have time coordinate recognized by ut_calendar
>
> ; if 5D [case,time,lev,lat,lon]
>
> ; arith: "avg" [also, "ave"], "sum","min","max" others may be added
>
> later
>
> ; nDim : scalar integer that specifies the 'time' dimension
> [generally, 0]
>
> ; opt : option ... not used here
>
> ;
>
> ; Sample usage: x(time,lat,lon) where time are n-hrly or daily values.
>
> ; xMonthAvg = calculate_monthly_values(x, "avg", 0, False)
>
> ; xMonthSum = calculate_monthly_values(x, "sum", 0, False)
>
> ; xMonthMin = calculate_monthly_values(x, "min", 0, False)
>
> ; xMonthMax = calculate_monthly_values(x, "max", 0, False)
>
> ;
>
>
> Anji Seth, Geography, UConn
> http://twitter.com/AnjiSeth
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed May 26 07:33:07 2010

This archive was generated by hypermail 2.1.8 : Wed May 26 2010 - 10:39:13 MDT