[Thread Prev][Thread Next][Index]

Re: [ferret_users] Area Average in Ferret



Hi Dogar,

It's probably because the first method accounts for missing values
correctly.

consider the 2x2 array

1 -
0 0


where the dash is a missing value. Clearly, the mean is 1/3.

However Doing the horizontal average first leads to 

1
0

which when averaged in y gives a "mean" of 0.5

Similarly doing the averaging in the opposite order first leads to a
value of 0.25

In short, when doing multidimensional averages your first method is the
correct way.

If you need to break up the calculation in two parts due to the size
then you need to account for the number of good values using the @NGD
transform to do the averaging correctly.


Russ

 


On Sat, 2013-06-22 at 15:34 +0000, Star Physicist wrote:
> Dear Ferret Users,
> 
> I have ocean data at different layers. Can some one explain me why the
> operation from following commands is different?
> 
> Let
> Anom1=Temp[x=-180:180@ave,y=-90:90@ave,k=2,d=1]-Temp[x=-180:180@ave,y=-90:90@ave,k=2,d=2]
> List Anom1
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> Let Test=Temp[x=-180:180@ave,k=2,d=1]-Temp[x=-180:180@ave@ave,k=2,d=2]
> Let Anom2=Test[y=-90:90@ave]
> List Anom2
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> Here Anom1 and Anom2 have different results!
> 
> Is it because in first step having both x and y averaging at the same
> time involves x and y grids sizes and their weights according to their
> sizes whereas in 2nd it doesn't apply grid size accordingly?
> Is the first method more appropriate?
> 
> 
> Thanks
> 
> Dogar
> 




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

Privacy Policy | Disclaimer | Accessibility Statement