[Thread Prev][Thread Next][Index]

[ferret_users] Details on using @AVE function correctly



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

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





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



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement