[Thread Prev][Thread Next][Index]

Re: mean or cumul on time axis



Hi Ansley,

Thanks for the documentation! I'll inform you if I encounter again strange results with Ferret on Mac.

I read that link and I understand there may be different weights with @ave, when grid boxes do not have the same area or when months are not considered as equal (weight ≠ 1/12 when taking into account their own respective length).
But in my case, as I consider just one grid box and as I try to compute a mean or cumul on days from 6 hourly data (so I should not have different weight as it may be the case for months), how can I do?

If I try to see "my" weights as in http://www.ferret.noaa.gov/Ferret/FAQ/analysis/regridding_with_ave.html, it seems to be ok as I get a 0.5 weight for 12-hourly average and a 0.25 weight for 24-hourly average (from originally 6-hourly data). However, I don't really catch the way Ferret puts up with "time-boundary data".
I'm sorry to insist, but I still do not understand how exactly Ferret computed the average in my previous example.
Here follow two examples. The first one is about weights, the second one is my previous example.

Emilie


SEE WEIGHTS

work@El Nino ~/Library/Ferret/go/zut > ferret
NOAA/PMEL TMAP
FERRET v5.50
apple-darwin6.3 - 02/08/03
30-Jul-04 11:12

! DEFINE THE VARIABLE 'VAR' (= 1 every 12 hours, 0 else)

yes? define axis/t="1-sep-1993 00:00":"3-SEP-1993 00:00":6/units=hours t6h
yes? let var = if L[gt=t6h] eq 1 or L[gt=t6h] eq 5 or L[gt=t6h] eq 9 then 1 else 0
yes? list var
VARIABLE : IF L[GT=T6H] EQ 1 OR L[GT=T6H] EQ 5 OR L[GT=T6H] EQ 9 THEN 1 ELSE 0
SUBSET : 9 points (TIME)
01-SEP-1993 00:00 / 1: 1.000
01-SEP-1993 06:00 / 2: 0.000
01-SEP-1993 12:00 / 3: 0.000
01-SEP-1993 18:00 / 4: 0.000
02-SEP-1993 00:00 / 5: 1.000
02-SEP-1993 06:00 / 6: 0.000
02-SEP-1993 12:00 / 7: 0.000
02-SEP-1993 18:00 / 8: 0.000
03-SEP-1993 00:00 / 9: 1.000

! DEFINE NEW TIME AXIS FOR REGRIDDING (12 and 24 hours)

yes? define axis/t="1-sep-1993 00:00":"3-SEP-1993 00:00":12/units=hours t12h
yes? define axis/t="1-sep-1993 00:00":"3-SEP-1993 00:00":24/units=hours t24h

! 12 HOURLY-AVERAGE

yes? list var[gt=t12h@ave]
VARIABLE : IF L[GT=T6H] EQ 1 OR L[GT=T6H] EQ 5 OR L[GT=T6H] EQ 9 THEN 1 ELSE 0
regrid: 12 hour on T@AVE
SUBSET : 5 points (TIME)
01-SEP-1993 00:00 / 1: 0.6667
01-SEP-1993 12:00 / 2: 0.0000
02-SEP-1993 00:00 / 3: 0.5000
02-SEP-1993 12:00 / 4: 0.0000
03-SEP-1993 00:00 / 5: 0.6667

! 24 HOURLY-AVERAGE

yes? list var[gt=t24h@ave]
VARIABLE : IF L[GT=T6H] EQ 1 OR L[GT=T6H] EQ 5 OR L[GT=T6H] EQ 9 THEN 1 ELSE 0
regrid: 24 hour on T@AVE
SUBSET : 3 points (TIME)
01-SEP-1993 00 / 1: 0.4000
02-SEP-1993 00 / 2: 0.2500
03-SEP-1993 00 / 3: 0.4000


PREVIOUS EXAMPLE

If the data are:
01-SEP-1993 00:00 / 1: 1.00
01-SEP-1993 06:00 / 2: 2.00
01-SEP-1993 12:00 / 3: 3.00
01-SEP-1993 18:00 / 4: 4.00
02-SEP-1993 00:00 / 5: 5.00
02-SEP-1993 06:00 / 6: 6.00
02-SEP-1993 12:00 / 7: 7.00
02-SEP-1993 18:00 / 8: 8.00
03-SEP-1993 00:00 / 9: 9.00
03-SEP-1993 06:00 / 10: 10.00
03-SEP-1993 12:00 / 11: 11.00
03-SEP-1993 18:00 / 12: 12.00
04-SEP-1993 00:00 / 13: 13.00

I would assume to get those numbers for the average:
(instead of xxxxx shows the results given by Ferret)

t12h@ave

01-SEP-1993 00:00 / 1: ( 1.00 + 2.00) /2 = 1.50 instead of 1.33
01-SEP-1993 12:00 / 2: ( 3.00 + 4.00) /2 = 3.50 3.00
02-SEP-1993 00:00 / 3: ( 5.00 + 6.00) /2 = 5.50 5.00
02-SEP-1993 12:00 / 4: ( 7.00 + 8.00) /2 = 7.50 7.00
03-SEP-1993 00:00 / 5: ( 9.00 + 10.00) /2 = 9.50 9.00
03-SEP-1993 12:00 / 6: (11.00 + 12.00) /2 = 11.50 11.00
04-SEP-1993 00:00 / 7: (13.00 + ? ) /2 = ? 12.67

t1d@ave

01-SEP-1993 00:00 / 1: ( 1.00 + 2.00 + 3.00 + 4.00) /4 = 2.50 instead of 1.80
02-SEP-1993 00:00 / 3: ( 5.00 + 6.00 + 7.00 + 8.00) /4 = 6.50 5.00
03-SEP-1993 00:00 / 5: ( 9.00 + 10.00 + 11.00 + 12.00) /4 = 10.50 9.00
04-SEP-1993 00:00 / 7: (13.00 + ? ) /4 = ? 12.20




Le 29 juil. 2004, ą 22:19, Ansley Manke a écrit :

Hi Emile,
I'm sending this back to the Users' List so the discussion is available to
everyone.

I don't know why you were seeing the incorrect results earlier.  Please let
us know if anything like that happens in the future.  When Ferret uses
@AVG  it looks at the size of the "boxes" along the axis and applies a
weighting factor based on the portion of the box on the source axis that
overlaps the box on the destination axis.  Some of this is discussed in the
FAQ,
http://www.ferret.noaa.gov/Ferret/FAQ/analysis/regridding_with_ave.html

I hope that it has enough explanation to answer your question.  I also find
that studying the output of commands like these are helpful in understanding
what the commands are doing:

yes? list t[gt=var], tbox[gt=var], tboxlo[gt=var], tboxhi[gt=var]
yes? list t[gt=var12h], tbox[gt=var12h], tboxlo[gt=var12h], tboxhi[gt=var]

Emilie Vanvyve wrote:

Hi Ansley,

Thanks for the rapidity of the answer! That's something I really appreciate with the Ferret users list!!

Here are some technical informations: I run Ferret on an Apple-Macintosh platform (Mac OS 10.3.4). It is the 5.50 version that I got from the link on the Ferret website towards Mac OS. Ferret welcomes me with:
NOAA/PMEL TMAP
FERRET v5.50
apple-darwin6.3 - 02/08/03
29-Jul-04 09:29

But, I just have tried your script right now on this platform (Mac, Ferret 5.50) and a Linux one (Linux 2.4.3, Ferret 5.51), I have gotten the same numbers as you this time. In a way, that's a good news, but I really do not understand why it has changed since yesterday. I am 100% sure of what I did and sent you. It can not have been confusion with previous variables I could had defined or something like this, as I quitted Ferret and reopened it to get what I sent you.

On the other hand, there is still something I do not understand in the results we both get now. The average does not seem to me to be an average and the sum a sum.

If the data are as previously:
01-SEP-1993 00:00 / 1: 1.00
01-SEP-1993 06:00 / 2: 2.00
01-SEP-1993 12:00 / 3: 3.00
01-SEP-1993 18:00 / 4: 4.00
02-SEP-1993 00:00 / 5: 5.00
02-SEP-1993 06:00 / 6: 6.00
02-SEP-1993 12:00 / 7: 7.00
02-SEP-1993 18:00 / 8: 8.00
03-SEP-1993 00:00 / 9: 9.00
03-SEP-1993 06:00 / 10: 10.00
03-SEP-1993 12:00 / 11: 11.00
03-SEP-1993 18:00 / 12: 12.00
04-SEP-1993 00:00 / 13: 13.00

I would assume to get those numbers for the average and the sum:

t12h@ave

01-SEP-1993 00:00 / 1: ( 1.00 + 2.00) /2 = 1.50 instead of 1.33
01-SEP-1993 12:00 / 2: ( 3.00 + 4.00) /2 = 3.50 3.00
02-SEP-1993 00:00 / 3: ( 5.00 + 6.00) /2 = 5.50 5.00
02-SEP-1993 12:00 / 4: ( 7.00 + 8.00) /2 = 7.50 7.00
03-SEP-1993 00:00 / 5: ( 9.00 + 10.00) /2 = 9.50 9.00
03-SEP-1993 12:00 / 6: (11.00 + 12.00) /2 = 11.50 11.00
04-SEP-1993 00:00 / 7: (13.00 + ? ) /2 = ? 12.67

t1d@ave

01-SEP-1993 00:00 / 1: ( 1.00 + 2.00 + 3.00 + 4.00) /4 = 2.50 instead of 1.80
02-SEP-1993 00:00 / 3: ( 5.00 + 6.00 + 7.00 + 8.00) /4 = 6.50 5.00
03-SEP-1993 00:00 / 5: ( 9.00 + 10.00 + 11.00 + 12.00) /4 = 10.50 9.00
04-SEP-1993 00:00 / 7: (13.00 + ? ) /4 = ? 12.20

t12h@sum

01-SEP-1993 00:00 / 1: ( 1.00 + 2.00) = 3.00 instead of 2.00
01-SEP-1993 12:00 / 2: ( 3.00 + 4.00) = 7.00 6.00
02-SEP-1993 00:00 / 3: ( 5.00 + 6.00) = 11.00 10.00
02-SEP-1993 12:00 / 4: ( 7.00 + 8.00) = 15.00 14.00
03-SEP-1993 00:00 / 5: ( 9.00 + 10.00) = 19.00 18.00
03-SEP-1993 12:00 / 6: (11.00 + 12.00) = 23.00 22.00
04-SEP-1993 00:00 / 7: (13.00 + ? ) = ? 19.00

t1d@sum

01-SEP-1993 00:00 / 1: ( 1.00 + 2.00 + 3.00 + 4.00) = 10.00 instead of 4.50
02-SEP-1993 00:00 / 3: ( 5.00 + 6.00 + 7.00 + 8.00) = 26.00 20.00
03-SEP-1993 00:00 / 5: ( 9.00 + 10.00 + 11.00 + 12.00) = 10.50 36.00
04-SEP-1993 00:00 / 7: (13.00 + ? ) = ? 30.50

If that's not the purpose of @ave and @sum, how could I then do with Ferret the cumul and mean I have reproduced here above?
Hoping it is possible,
best regards,

Emilie


Le 28 juil. 2004, ą 19:35, Ansley Manke a écrit :


Hi Emilie,
Thank you for sending this example.  What version of Ferret are you running, and on
what operating system?  The results you are seeing are clearly wrong.  When I run
your script, I see the following results (first I list the script, then the results.  I get these
same results on both our Solaris and Linux machines with Ferret version 5.6):



! ----------------- regridtime.jnl -----------------
! Create dummy variable
define axis/t="1-sep-1993 00:00":"4-SEP-1993 00:00":6/units=hours t6h
let var = L[gt=t6h]
list var

! Regrid to 12-hour and to 1-day with @sum

define axis/t="01-SEP-1993 00:00":"4-SEP-1993 00:00":12/units=hours t12h
let var12h = var[gt=t12h@ave]
list var12h

define axis/t="01-SEP-1993 00:00":"4-SEP-1993 00:00":1/units=days t1d
let var1d = var[gt=t1d@ave]
list var1d

! Regrid to 12-hour and to 1-day with @sum

define axis/t="01-SEP-1993 00:00":"4-SEP-1993 00:00":12/units=hours t12h
let var12h = var[gt=t12h@sum]
list var12h

define axis/t="01-SEP-1993 00:00":"4-SEP-1993 00:00":1/units=days t1d
let var1d = var[gt=t1d@sum]
list var1d



Here is the output



yes? ! ----------------- regridtime.jnl -----------------
yes? ! Create dummy variable
yes? define axis/t="1-sep-1993 00:00":"4-SEP-1993 00:00":6/units=hours t6h
yes? let var = L[gt=t6h]
yes? list var
             VARIABLE : L[GT=T6H]
             SUBSET   : 13 points (TIME)
 01-SEP-1993 00:00 /  1:   1.00
 01-SEP-1993 06:00 /  2:   2.00
 01-SEP-1993 12:00 /  3:   3.00
 01-SEP-1993 18:00 /  4:   4.00
 02-SEP-1993 00:00 /  5:   5.00
 02-SEP-1993 06:00 /  6:   6.00
 02-SEP-1993 12:00 /  7:   7.00
 02-SEP-1993 18:00 /  8:   8.00
 03-SEP-1993 00:00 /  9:   9.00
 03-SEP-1993 06:00 / 10:  10.00
 03-SEP-1993 12:00 / 11:  11.00
 03-SEP-1993 18:00 / 12:  12.00
 04-SEP-1993 00:00 / 13:  13.00

yes? ! Regrid to 12-hour and to 1-day with @sum

yes? define axis/t="01-SEP-1993 00:00":"4-SEP-1993 00:00":12/units=hours t12h
yes? let var12h = var[gt=t12h@ave]
yes? list var12h
             VARIABLE : VAR[GT=T12H@AVE]
             SUBSET   : 7 points (TIME)
 01-SEP-1993 00:00 / 1:   1.33
 01-SEP-1993 12:00 / 2:   3.00
 02-SEP-1993 00:00 / 3:   5.00
 02-SEP-1993 12:00 / 4:   7.00
 03-SEP-1993 00:00 / 5:   9.00
 03-SEP-1993 12:00 / 6:  11.00
 04-SEP-1993 00:00 / 7:  12.67

yes? define axis/t="01-SEP-1993 00:00":"4-SEP-1993 00:00":1/units=days t1d
yes? let var1d = var[gt=t1d@ave]
yes? list var1d
             VARIABLE : VAR[GT=T1D@AVE]
             SUBSET   : 4 points (TIME)
 01-SEP-1993 00 / 1:   1.80
 02-SEP-1993 00 / 2:   5.00
 03-SEP-1993 00 / 3:   9.00
 04-SEP-1993 00 / 4:  12.20

yes? ! Regrid to 12-hour and to 1-day with @sum

yes? define axis/t="01-SEP-1993 00:00":"4-SEP-1993 00:00":12/units=hours t12h
yes? let var12h = var[gt=t12h@sum]
yes? list var12h
             VARIABLE : VAR[GT=T12H@SUM]
             SUBSET   : 7 points (TIME)
 01-SEP-1993 00:00 / 1:   2.00
 01-SEP-1993 12:00 / 2:   6.00
 02-SEP-1993 00:00 / 3:  10.00
 02-SEP-1993 12:00 / 4:  14.00
 03-SEP-1993 00:00 / 5:  18.00
 03-SEP-1993 12:00 / 6:  22.00
 04-SEP-1993 00:00 / 7:  19.00

yes? define axis/t="01-SEP-1993 00:00":"4-SEP-1993 00:00":1/units=days t1d
yes? let var1d = var[gt=t1d@sum]
yes? list var1d
             VARIABLE : VAR[GT=T1D@SUM]
             SUBSET   : 4 points (TIME)
 01-SEP-1993 00 / 1:   4.50
 02-SEP-1993 00 / 2:  20.00
 03-SEP-1993 00 / 3:  36.00
 04-SEP-1993 00 / 4:  30.50

! -----------------



Emilie Vanvyve wrote:

Hello!

I need some help to regrid data on time. I have 6-hourly precipitation values and I'd like to have the cumul and the mean on 1 day. I have tried by defining a new time axis and regridding the data using gt=my_new_time_axis@sum and @ave. Ferret obviously computes something, the time axis of my new variable is correct, but I'm a bit perplex about the results Ferret gives me.

Here is an example with a dummy variable.

yes? list var
SUBSET : 13 points (TIME)
01-SEP-1993 00:00 / 1: 1.00
01-SEP-1993 06:00 / 2: 2.00
01-SEP-1993 12:00 / 3: 3.00
01-SEP-1993 18:00 / 4: 4.00
02-SEP-1993 00:00 / 5: 5.00
02-SEP-1993 06:00 / 6: 6.00
02-SEP-1993 12:00 / 7: 7.00
02-SEP-1993 18:00 / 8: 8.00
03-SEP-1993 00:00 / 9: 9.00
03-SEP-1993 06:00 / 10: 10.00
03-SEP-1993 12:00 / 11: 11.00
03-SEP-1993 18:00 / 12: 12.00
04-SEP-1993 00:00 / 13: 13.00

yes? define axis/t="01-SEP-1993 00:00":"4-SEP-1993 00:00":12/units=hours t12h
yes? let var12h = var[gt=t12h@ave]
yes? list var12h
VARIABLE : VAR[GT=T12H@AVE]
SUBSET : 7 points (TIME)
01-SEP-1993 00:00 / 1: 1.000
01-SEP-1993 12:00 / 2: 2.000
02-SEP-1993 00:00 / 3: 3.000
02-SEP-1993 12:00 / 4: 4.000
03-SEP-1993 00:00 / 5: 5.000
03-SEP-1993 12:00 / 6: 6.000
04-SEP-1993 00:00 / 7: 7.000

yes? define axis/t="01-SEP-1993 00:00":"4-SEP-1993 00:00":1/units=days t1d
yes? let var1d = var[gt=t1d@ave]
yes? list var1d
VARIABLE : VAR[GT=T1D@AVE]
SUBSET : 4 points (TIME)
01-SEP-1993 00 / 1: 1.333
02-SEP-1993 00 / 2: 3.000
03-SEP-1993 00 / 3: 5.000
04-SEP-1993 00 / 4: 6.667

yes? define axis/t="01-SEP-1993 00:00":"4-SEP-1993 00:00":12/units=hours t12h
yes? let var12h = var[gt=t12h@sum]
yes? list var12h
VARIABLE : VAR[GT=T12H@SUM]
SUBSET : 7 points (TIME)
01-SEP-1993 00:00 / 1: 1.000
01-SEP-1993 12:00 / 2: 2.000
02-SEP-1993 00:00 / 3: 3.000
02-SEP-1993 12:00 / 4: 4.000
03-SEP-1993 00:00 / 5: 5.000
03-SEP-1993 12:00 / 6: 6.000
04-SEP-1993 00:00 / 7: 7.000

yes? define axis/t="01-SEP-1993 00:00":"4-SEP-1993 00:00":1/units=days t1d
yes? let var1d = var[gt=t1d@sum]
yes? list var1d
VARIABLE : VAR[GT=T1D@SUM]
SUBSET : 4 points (TIME)
01-SEP-1993 00 / 1: 2.00
02-SEP-1993 00 / 2: 6.00
03-SEP-1993 00 / 3: 10.00
04-SEP-1993 00 / 4: 10.00
yes?

Where am I wrong?

Thanks for any clue!

Emilie

____________________________________________________________
Emilie VANVYVE
Physicist, PhD student

Université catholique de Louvain (UCL)
Institut d'astronomie et de géophysique G. LemaĒtre (ASTR)
Chemin du Cyclotron, 2
1348 Louvain-la-Neuve (Belgium)
Phone : +32-(0)10-473300
Fax : +32-(0)10-474722
E-mail : vanvyve@astr.ucl.ac.be
Web : www.astr.ucl.ac.be



____________________________________________________________
Emilie VANVYVE
Physicist, PhD student

Université catholique de Louvain (UCL)
Institut d'astronomie et de géophysique G. LemaĒtre (ASTR)
Chemin du Cyclotron, 2
1348 Louvain-la-Neuve (Belgium)
Phone : +32-(0)10-473300
Fax : +32-(0)10-474722
E-mail : vanvyve@astr.ucl.ac.be
Web : www.astr.ucl.ac.be



____________________________________________________________
Emilie VANVYVE
Physicist, PhD student

Université catholique de Louvain (UCL)
Institut d'astronomie et de géophysique G. LemaĒtre (ASTR)
Chemin du Cyclotron, 2
1348 Louvain-la-Neuve (Belgium)
Phone : +32-(0)10-473300
Fax : +32-(0)10-474722
E-mail : vanvyve@astr.ucl.ac.be
Web : www.astr.ucl.ac.be


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement