# Re: monthly climatology

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 22 Feb 2007 10:00:08 -0700 (MST)

>How can I calculate monthly climatology from daily values?
>I mean, is there any function similar to "clmDayTLL" which can calculate
>monthly climatology from daily values.

There is no built-in function for this operation.

It is easy to create one.

If you have time in units of (say) yyyymmdd
you could do something like [ untested]

You will have to adjust to how you want the data returned.

function calcMonMean_DayValues( time[*], x[*])
begin
ntim = dimsizes(time)

yrStrt = time(0)/10000 ; yyyymmdd
yrLast = time(ntim-1)/10000

nyrs = (yrLast-yrStrt+1)
nmos = 12

year = time/10000
mmdd = time - year*10000
mm = mmdd/100
dd = mmdd - mm*100

xMon = new ( (/nyrs,nmos/), typeof(x), getFillValue(x))

do nyr=0,nyrs-1
do nmo=1,nmos

i = ind(year.eq.year(nyr) .and. nmo.eq.mm)
xMon(nyr,nmo-1) = avg( x(1) )

delete(i)
end do
end do

xMon_at_long_name = "Monthly Mean:
if (isatt(x,"long_name")) then
xMon_at_long_name = "Monthly Mean: "+x_at_long_name
end if

if (isatt(x,"units")) then
xMon_at_units = x_at_units
end if

return (xMon)
end

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Feb 22 2007 - 10:00:08 MST

This archive was generated by hypermail 2.2.0 : Fri Feb 23 2007 - 17:16:15 MST