[Thread Prev][Thread Next][Index]

[ferret_users] monthly average



Hello ferret users,
 I have monthly averages of some dataset for each time record in a day in a time axis as shown below,
 

list/l=1:10/x=75/y=-10 lw
             VARIABLE : STR/(60*60*3)
             FILENAME : lw_new.nc
             SUBSET   : 10 points (TIME)
             LONGITUDE: 75E
             LATITUDE : 10.5S
                           75E  
                           51
 01-JAN-1989 00:00 /  1:  -51.5
 01-JAN-1989 03:00 /  2: -103.5
 01-JAN-1989 06:00 /  3: -155.0
 01-JAN-1989 09:00 /  4: -205.6
 01-JAN-1989 12:00 /  5:  -49.8
 01-JAN-1989 15:00 /  6: -100.0
 01-JAN-1989 18:00 /  7: -151.5
 01-JAN-1989 21:00 /  8: -204.1
 01-FEB-1989 00:00 /  9:  -50.1
 01-FEB-1989 03:00 / 10: -100.5
 
I want to average each month's values and get it in a monthly calendar
I first tried with a daily calendar to get the sum, thinking that all days other than first day of a month will be undefined as there in no data in there....
but I got something like this


define axis/t="1-jan-1989 00:00":"1-jan-2010 00:00":1/edges/units=days/calendar=gregorian tdaily
let lw_mon=lw[gt=tdaily@sum]
 LET lw=STR/(60*60*3)
 LET lw_mon=lw[gt=tdaily@sum]
 LIST/l=1:8/x=75/y=-10 lw
             VARIABLE : STR/(60*60*3)
             FILENAME : lw_new.nc
             SUBSET   : 8 points (TIME)
             LONGITUDE: 75E
             LATITUDE : 10.5S
                          75E  
                          51
 01-JAN-1989 00:00 / 1:  -51.5
 01-JAN-1989 03:00 / 2: -103.5
 01-JAN-1989 06:00 / 3: -155.0
 01-JAN-1989 09:00 / 4: -205.6
 01-JAN-1989 12:00 / 5:  -49.8
 01-JAN-1989 15:00 / 6: -100.0
 01-JAN-1989 18:00 / 7: -151.5
 01-JAN-1989 21:00 / 8: -204.1
 LIST/l=1:5/x=75/y=-10 lw_mon
             VARIABLE : LW[GT=TDAILY@SUM]
             FILENAME : lw_new.nc
             SUBSET   : 5 points (TIME)
             LONGITUDE: 75E
             LATITUDE : 10.5S
                       75E  
                       51
 01-JAN-1989 12 / 1: -793.7
 02-JAN-1989 12 / 2:  -13.5
 03-JAN-1989 12 / 3:  -13.5
 04-JAN-1989 12 / 4:  -13.5
 05-JAN-1989 12 / 5:  -13.5

I should get 1024 as sum for 1-jan 1989, and the other days showing some values too.

Why is it coming so and Where I am doing wrong???

I tried with a monthly axis also, where results were better but not exact

 LET start_year = 1989
 LET nyears = 20
 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 lw_mon=lw[gt=truemonth@sum]
 LIST/l=1:5/x=75/y=-10 lw_mon
             VARIABLE : LW[GT=TRUEMONTH@SUM]
             FILENAME : lw_new.nc
             SUBSET   : 5 points (TIME)
             LONGITUDE: 75E
             LATITUDE : 10.5S
                       75E  
                       51
 16-JAN-1989 12 / 1: -1045.
 15-FEB-1989 00 / 2:  -989.
 16-MAR-1989 12 / 3: -1033.
 16-APR-1989 00 / 4:  -982.
 16-MAY-1989 12 / 5: -1039.

when I removed edges in axis defenition I was getting almost correct values except for first time step. But  I couldn't understand why this is happening.
 
Is there any better way to get this done ?

Thanks in advance...

Rahul
Research Fellow
Indian Institute of Tropical Meteorology
Pune, India


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement