[Thread Prev][Thread Next][Index]

Re: [ferret_users] Details on using @AVE function correctly



Hi Ansley,
Yes, I think that is more clear than before. When someone wants to know about @AVE, they may not go to the "General information about transformations" section and thus miss out on this important point. I think this is a very easy mistake to make, using coordinates for @AVE and expecting to get an arithmetic mean back. The difference between using coordinates and indices in the mean doesn't amount to a whole lot of numerical diffferences (at least for some of the cases I have seen), which adds a bit to the confusion since there are no glaring discrepancies.

Thanks for your reply.

Steve



Quoting Ansley Manke <ansley.b.manke@noaa.gov>:

Hi Steve,
Where are you looking in the documentation? Sometimes we who write docs are too close to it all and can't see where confusion arises. There is this paragraph a little ways down under

*Ch3 Sec2.4.1. * *General information about transformations
*


...If integration or averaging limits are given as world
coordinates, the grid boxes at the edges of the region specified are
weighted according to the fraction of grid box that actually lies
within the specified region. If the transformation limits are given
as subscripts, the full box size of each grid point along the axis
is used---including the first and last subscript given. The region
information that is listed with the output reflects this.


But, I guess that we could also add to the @AVE section, perhaps something like the *BOLD* text below.

*Ch3 Sec2.4.6. * *@AVE---average *

The transformation @AVE computes the average weighted by grid box size---a single number representing the average of the variable between two endpoints. *When the endpoints are expressed as coordinates, e.g. var[X=3.5:8@AVE], then the average is weighted with partial box sizes so that the average extends from exactly x=3.5 to 8. If the endpoints are expressed as indices, e.g. var[L=5:12@AVE] then entire boxes contribute to the average.
*

*
*



guimond@coaps.fsu.edu wrote:
Hi Jaison,
Thank you for your response. This is a very nice review of the @AVE functions and something I think should be added to the documentation. It is not obvious how the grid box weights are computed from what is given and one could easily trust the values when in fact they would be wrong. I will post this response to the group. So, basically using the calendar format (i.e. var[t=02-JAN-2001:05-JAN-2001@AVE]) of @AVE will ALWAYS underestimate the mean because of the 0.50 weight on each end. I think another way to get at the correct method would be to:

let new_var = var[t=02-JAN-2001:05-JAN-2001]

let new_var_mean = new_var[t=@AVE]

This computes the mean over all the grid cells in range by removing the values from the rest of the data.


Any idea why @AVE was created like this?


Thanks again,

Steve


Quoting Jaison Kurian <jaison@caos.iisc.ernet.in>:

Hi Steve,
I faced a simular confusion earlier...that time Ansley
clarified my doubts.

Basically over "co-ordinate axes" ie. X/Y/Z/T, @AVE is weigthed
by grid box lenth, based on the specified region. But over "abstract
axes or indices" ie. I/J/K/L it is not. Let us see one example.

define axis/t=01-JAN-2001:06-JAN-2001:1/units=days/t0=31-DEC-2000 time
let var = SIN(t[gt=time])
set list/precision=10

! first 3-methods to find ave

list var[l=2:5@AVE]
list var[t=02-JAN-2001:05-JAN-2001@SUM]/var[t=02-JAN-2001:05-JAN-2001@NGD]
list var[t="01-JAN-2001:12":"05-JAN-2001:12"@AVE]

! fourth method to find ave

list var[t=02-JAN-2001:05-JAN-2001@AVE]

The first 3 list commands will give the same answer, the sum of variable
values from 2nd to 5th devided by number of points, ie. 4. But the last one
will give a different anwer. Let me explain in detail.

The first time point is "01-JAN-2001:00:00"
its bounds are "31-DEC-2000:12:00" and "01-JAN-2001:12:00"
The second time point is "02-JAN-2001:00:00"
its bounds are "01-JAN-2001:12:00" and "02-JAN-2001:12:00"

Hence when you are specifying as the starting T for an average
operation as "02-JAN-2001",only half of the grid box comes after
this time (ie. from "02-JAN-2001:00:00" to "02-JAN-2001:12:00")
hence this value gets only 0.5 weightage..similar is the case
with the value on "05-JAN-2001". So, the average

var[t=02-JAN-2001:05-JAN-2001@AVE]

will be computed as

(var[t=02-JAN-2001]*0.5+var[t=03-JAN-2001]*1+var[t=04-JAN-2001]*1+
var[t=05-JAN-2001]*0.5)/3

This problem is overcome by specifying exact grid boundaries in method
3 above. In method 2 a combination of @SUM and @NGD has been used. Since
@SUM is a non-weighted calculation, this will give the answer without
any problems like method 4 above.

Back to your question
---------------------
So what should a proper method for simple mean ? Any of first 3 methods
from above example. Then you may ask, how to make it easier with the
time specified on calendar format : here is the trick

let l1 = L[gt=var,t=02-JAN-2001]
let l2 = L[gt=var,t=05-JAN-2001]
list var[l=`l1`:`l2`@AVE]

Hope this helps,

Regards,

Jaison

On Mon, 16 Oct 2006 guimond@coaps.fsu.edu wrote:

Hi Jaison,
  I decided to e-mail you separatley about this question and then I
will post the responses to the group.  I have computed some means and I
am questioning how ferret goes about them.  Specifically, I have
computed the time mean of a var between two endpoints, call them t1 and
t2:

let mean1 = var[t=`t1`:`t2`@AVE]

According to the FERRET users guide, this will be the mean over the
"exact" region or from gridpoint to gridpoint, correct?  Now if I do
something like this:

let mean2 = var[l=10:15@AVE], using time steps instead of time values.

I will get a different answer because this method averages from
gridcell to gridcell and not gridpoint to gridpoint, correct?

I am confused on what is the more accurate depiction of the mean here.
I want to average from one single time point, t1, to another time
point, t2.  This is why I used the formula for mean1.  Is this correct
for simple means?

Thanks for your help,
Steve Guimond

----------------------------------------------------------------





----------------------------------------------------------------


--

~> ~> ~> ~> ~> ~> ~> ~> ~> ~> ~> Ansley Manke, NOAA/PMEL ansley.b.manke@noaa.gov
7600 Sand Point Way NE, Seattle WA
Phone 206-526-6246, FAX 206-526-6744







----------------------------------------------------------------



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement