<div dir="ltr"><div>[1] <br>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.<br><br></div><div>In any case, there is no need to use:  clat=doubletofloat(f-&gt;lat)</div><div><br></div><div>[2]  In any case, your method 1 should be<br><br>wt        = conform(tas,clat,0)<br>tave1   = sum(tas*wt)/sum(wt)   ;;method1 ... weighted average<br><br>[3]<br></div><div>If the grid is gaussian, you should use gaussian weights.<br></div><div>Usually, the gaussian weights are provided on the source file.<br>If they are not on the file , use<br><br><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/latGauWgt.shtml">https://www.ncl.ucar.edu/Document/Functions/Contributed/latGauWgt.shtml</a><br><br></div><div>Then use wgt_areaave<br><br></div><div>Cheers<br></div><div><br></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 17, 2016 at 11:06 AM, Sitan Heyl <span dir="ltr">&lt;<a href="mailto:heylsitan@gmail.com" target="_blank">heylsitan@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div>  I know two methods (as below) to calculate global average, but I don&#39;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. </div><div>  by the way, is the method 1 right if the grid is gaussian grid?</div><div><br></div><div><br></div><div>f=addfile(&quot;<a href="http://cru_ts3.23.1901.2014.tmp.dat.nc" target="_blank">cru_ts3.23.1901.2014.tmp.dat.nc</a>&quot;,&quot;r&quot;)</div>tas=f-&gt;tmp(1000,:,:)<br>printVarSummary(tas)<br>clat=doubletofloat(f-&gt;lat)<br>rad=4.0*atan(1.0)/180.<br>clat=sqrt(cos(clat*rad))<br><br>wt=tas<br>wt=tas*conform(tas,clat,0)<br>tave1=avg(wt)   ;;method1<br><br>tave2=wgt_areaave(tas,clat,1.0,1) ;;method2<br><br>print(tave1)<br>print(tave2)</div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>