[Thread Prev][Thread Next][Index]

Re: [ferret_users] 360_day calendar annual mean



Hi -
Here is a question that was sent just to me, but it's of general interest, so I'll post my answer below.

On 3/16/2012 11:35 AM, Kelin Zhuang wrote:
Dear Ansley,
When I try to make an annual of a variable from 1985 to 2004, I use the following algorithm: define axis/calendar=360_day/edges/t0=1-jan-1900/units=days timeline=days1900(x[i=1985:2005:1],1,1)
let y=x[gt=timeline@ave]
But I got the first data as 29-sep-1986 and
 SEP-1986 /  1:   1.00
 OCT-1987 /  2:   2.00
 OCT-1988 /  3:   3.00
 OCT-1989 /  4:   4.00
 OCT-1990 /  5:   5.00
 OCT-1991 /  6:   6.00
 OCT-1992 /  7:   7.00
 NOV-1993 /  8:   8.00
 NOV-1994 /  9:   9.00
 NOV-1995 / 10:  10.00
 NOV-1996 / 11:  11.00
 NOV-1997 / 12:  12.00
 DEC-1998 / 13:  13.00
 DEC-1999 / 14:  14.00
 DEC-2000 / 15:  15.00
 DEC-2001 / 16:  16.00
 DEC-2002 / 17:  17.00
 DEC-2003 / 18:  18.00
 JAN-2005 / 19:  19.00
 JAN-2006 / 20:  20.00
That's not what I want. When using gregorian or other calendars, I can get Jul16 of every year. Thanks for your help in advance,

Best regards,
Kelin


The function DAYS1900 is based on Ferret's default Proleptic Gregorian calendar, so it isn't what you want to use to define the timesteps for a 360-day calendar axis. Better to construct the times directly. This is easy because every year is the same length. You can put the time origin anywhere, but it could go something like this:

yes? define axis/calendar=360_day/edges/t0=1-jan-1984/units=days timeline=360*t[t=1:29]
Replacing definition of axis TIMELINE
yes? list t[gt=timeline]
             VARIABLE : T
                        axis TIMELINE
             SUBSET   : 28 points (TIME)
             CALENDAR : 360_DAY
 JUL-1985 /  1:    540.
 JUL-1986 /  2:    900.
 JUL-1987 /  3:   1260.
 JUL-1988 /  4:   1620.
 JUL-1989 /  5:   1980.
 JUL-1990 /  6:   2340.
 JUL-1991 /  7:   2700.
 JUL-1992 /  8:   3060.
 JUL-1993 /  9:   3420.
 JUL-1994 / 10:   3780.
 JUL-1995 / 11:   4140.
 JUL-1996 / 12:   4500.
 JUL-1997 / 13:   4860.
 JUL-1998 / 14:   5220.

...


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

Privacy Policy | Disclaimer | Accessibility Statement