[ncl-talk] the method for global avereage

Sitan Heyl heylsitan at gmail.com
Wed Feb 17 11:06:05 MST 2016


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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160217/1ab4404f/attachment.html 


More information about the ncl-talk mailing list