Computing monthly-mean using daily data

From: Christian Pagé <page.christian_at_nyahnyahspammersnyahnyah>
Date: Thu, 7 Feb 2008 12:15:45 +0100

Hello all,

I am still a newbie regarding NCL advanced array functions and subscripting
(I always think more in a C-like programming fashion).
It is probably why I cannot find a proper way to do the following
efficiently using NCL :

Goal : compute monthly-mean using daily data...

I have a CF-1.0 compliant NetCDF file with some daily-data 2D fields
(time,x,y).
I also have the time in a 1D vector in hours.
I want to compute the monthly mean and variance and generate two monthly
data fields.

I already dealt with time :
time = filein->time ; time:units = "hours
since"
TIME = ut_calendar(time, 0) ; type float
year = floattointeger( TIME(:,0) )
month = floattointeger( TIME(:,1) )
day = floattointeger( TIME(:,2) )

and I have my field, accessing it with : filein->dailyfield

Now, the question is :
Is there an efficient way to loop over time, and :
- Find indices which belong to a specific month/year couple
- Mean my field on all these indices
- Mark this month/year couple as "done"

as I don't know in advance :
- the number of years in the input data
- the number of months for each year in the input data (whole years are not
in the same files)

This can be done easily in C using standard loops and extra vectors to keep
track of what has been done.

Many thanks for any hints or solutions...! :)

-- 
Christian Pagé

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Feb 07 2008 - 04:15:45 MST

This archive was generated by hypermail 2.2.0 : Thu Feb 07 2008 - 08:58:57 MST