Hi Wim-Paul,
Two steps:
- define the time axis onto which you want the data averaged
- request the average (a weighted average to allow for unmatched
bounds of the time axis cells)
For step 1, you presumably want a Gregorian monthly axis -- unequal
month lengths, including leap years, etc. (interesting biases we work
with in science, aren't they?) See the index of the Ferret Users Guide
(http://ferret.wrc.noaa.gov/Ferret/Documentation/Users_Guide/current/fer_html.htm).
Look under AXIS/Define for a general discussion of calendar types and
under AXIS/EDGES (oddly) in Ref Sec4.3. DEFINE AXIS for a
description of how to create a monthly calendar axis. For step 2 the
weighted averaging is done with the @AVE transform. See Transformation
/ @AVE in the Users' Guide.
Here's an example:
! define a 20 year monthly axis starting in Jan 1950
let start_year = 1950
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)
! examine one year of it ... just to have a look
show axis/T=1-jan-1958:1-jan-1959 truemonth
The weighted regridding is simply:
LET my_var_ave = my_var[GT=truemonth@AVE]
then
PLOT/T=1-jan-1958:1-jan-1959 my_var_ave
or whatever.
- Steve
=================================================
Wim-Paul Breugem wrote:
Dear ferret
users,
I have a dataset of 5-day means. The corresponding dates on
a standard calender are given for the third day of the 5-day interval.
As an example I show you here a subset of the data:
yes? list/i=1/j=1/k=1/l=1:20 temp
03-JAN-1958 12 / 1: 19.04
08-JAN-1958 12 / 2: 20.35
13-JAN-1958 12 / 3: 21.18
18-JAN-1958 12 / 4: 21.57
23-JAN-1958 12 / 5: 21.53
28-JAN-1958 12 / 6: 21.75
02-FEB-1958 12 / 7: 21.94
07-FEB-1958 12 / 8: 22.03
12-FEB-1958 12 / 9: 22.39
17-FEB-1958 12 / 10: 22.48
22-FEB-1958 12 / 11: 22.43
27-FEB-1958 12 / 12: 22.63
04-MAR-1958 12 / 13: 22.92
09-MAR-1958 12 / 14: 23.00
14-MAR-1958 12 / 15: 22.98
19-MAR-1958 12 / 16: 22.99
24-MAR-1958 12 / 17: 23.01
29-MAR-1958 12 / 18: 23.08
03-APR-1958 12 / 19: 23.10
08-APR-1958 12 / 20: 23.15
Does anybody know how to calculate from this the corresponding monthly
means? Thus, how do I obtain the monthly means for Jan 1958, Feb 1958,
etc.?
Note that the 5-day means are usually not aligned with the edges of the
months, so the 5-day means should not all have the same weight in the
monthly averaging.
I'm looking forward to a solution for this problem!
With best regards,
Wim-Paul Breugem
--
--
Steve Hankin, NOAA/PMEL -- Steven.C.Hankin@noaa.gov
7600 Sand Point Way NE, Seattle, WA 98115-0070
ph. (206) 526-6080, FAX (206) 526-6744
|