[Thread Prev][Thread Next][Index]

[ferret_users] Calculating monthly means from twice daily data



Hi all,

I'm a Ferret newbie and having trouble seeing where I'm going wrong with this so hoping one of you can help!

I've got twice daily data (at 00:00 and 12:00) between 1st April 2004 and 20th December 2010 from which I'm trying to calculate monthly means.  The first day in the time series only has one data point (at 12:00) and so to get around this I'm first calculating daily means, and then using these to calculate the monthly means using the following code.

use moc_transports.nc

! firstly, define daily means (to be sure to avoid problems when there is for example only one data a day instead of two....)

DEFINE AXIS/T=1-apr-2004:20-dec-2010:1/UNITS=days tdays
LET daily_MOC = MOC_MAR_HC10[gt=tdays@AVE]

! calculate monthly means

LET start_year = 2004
LET nyears = 7
LET indices = L[L=1:`nyears*12`]
LET month = MOD(indices-1,12)+1
LET year = start_year + INT((indices-1)/12)
DEFINE AXIS/UNITS=days/T0=1-jan-1900/EDGES truemonth = DAYS1900(year,month,1)
LET monthly_moc= daily_MOC[gt=truemonth@AVE]


However I've checked the few few days (see below) and the daily_moc calculation appears to be averaging the two values for the specific day along with the second value from the previous day which is not what I want, but I can't figure out where I'm going wrong.

yes? list moc_mar_hc10[l=1:11]
             VARIABLE : overturning transport (Sv)
             FILENAME : moc_transports.nc
             SUBSET   : 11 points (TIME)
 01-APR-2004 12:00 /  1:   9.83
 02-APR-2004 00:00 /  2:  10.30
 02-APR-2004 12:00 /  3:  10.73
 03-APR-2004 00:00 /  4:  11.11
 03-APR-2004 12:00 /  5:  11.44
 04-APR-2004 00:00 /  6:  11.70
 04-APR-2004 12:00 /  7:  11.90
 05-APR-2004 00:00 /  8:  12.05
 05-APR-2004 12:00 /  9:  12.16
 06-APR-2004 00:00 / 10:  12.25
 06-APR-2004 12:00 / 11:  12.34

             VARIABLE : MOC_MAR_HC10[GT=TDAYS@AVE]
             FILENAME : moc_transports.nc
             SUBSET   : 6 points (TIME)
 01-APR-2004 00 / 1:   9.83
 02-APR-2004 00 / 2:  10.29
 03-APR-2004 00 / 3:  11.10
 04-APR-2004 00 / 4:  11.69
 05-APR-2004 00 / 5:  12.04
 06-APR-2004 00 / 6:  12.25

Any help on this will be greatfully received!

Thanks in advance,

Helen

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement