[ncl-talk] the method for global avereage

Dennis Shea shea at ucar.edu
Wed Feb 17 11:23:39 MST 2016


[1]
The sqrt(clat) is used for EOF calculations because a covariance matrix is
used. Each entry into the covariance array may be from different latitudes.
Values at the same latitude would yield ...  sqrt(clat))*sqrt(clat))=clat.
The sqrt for a global average should not be used.

In any case, there is no need to use:  clat=doubletofloat(f->lat)

[2]  In any case, your method 1 should be

wt        = conform(tas,clat,0)
tave1   = sum(tas*wt)/sum(wt)   ;;method1 ... weighted average

[3]
If the grid is gaussian, you should use gaussian weights.
Usually, the gaussian weights are provided on the source file.
If they are not on the file , use

https://www.ncl.ucar.edu/Document/Functions/Contributed/latGauWgt.shtml

Then use wgt_areaave

Cheers



On Wed, Feb 17, 2016 at 11:06 AM, Sitan Heyl <heylsitan at gmail.com> wrote:

> Hi,
>   I know two methods (as below) to calculate global average, but I don't
> know which one is right or better. before, I always use method 1. but I
> find the results of two methods are not same.
>   by the way, is the method 1 right if the grid is gaussian grid?
>
>
> f=addfile("cru_ts3.23.1901.2014.tmp.dat.nc","r")
> tas=f->tmp(1000,:,:)
> printVarSummary(tas)
> clat=doubletofloat(f->lat)
> rad=4.0*atan(1.0)/180.
> clat=sqrt(cos(clat*rad))
>
> wt=tas
> wt=tas*conform(tas,clat,0)
> tave1=avg(wt)   ;;method1
>
> tave2=wgt_areaave(tas,clat,1.0,1) ;;method2
>
> print(tave1)
> print(tave2)
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160217/63c969ef/attachment.html 


More information about the ncl-talk mailing list