Re: accounting for surface area differences when averaging

From: Adam Phillips (asphilli AT cgd.ucar.edu)
Date: Fri Mar 18 2005 - 11:10:28 MST


Hi Cathy,

(dim_avg does not take differences in grid box size into account, it just
averages across the rightmost dimension of your input array.)

I think what you want to use is wgt_areaave, that way you can weight the
latitudes by either the cosine of the latitudes or by the gaussian weights.
Either method gives less weight to the pts close to the poles (smaller grid
boxes), and more weight to those pts closer to the equator (larger grid boxes).

If the array is on a gaussian grid, most people use the gaussian weights. If you
don't have them they can be calculated in NCL using the gaus function
(http://ngwww.ucar.edu/ngdoc/ng/ref/ncl/functions/gaus.html). There is also a
function in contributed.ncl that returns the gaussian weights directly to the
left side of the equation called latGauWgt
(http://www.cgd.ucar.edu/csm/support/Data_P/Contributed/latgauwgt.shtml). If you
use this function make sure you load contributed.ncl at the top of your script.
(http://www.cgd.ucar.edu/csm/support/Data_P/contrib_bycat.shtml)

I believe the difference between cosine weighting the data and gaussian
weighting the data is usually minor, someone else can chime in on this if they
disagree. Here is a snippet of code I use to calculate an area average using
cosine weighting, in this case the Nino3.4 timeseries:

;obs is a 3D array dimensioned time,lat,lon
pi=4.*atan(1.0)
rad=(pi/180.)
coswgt=cos(rad*obs&lat)
coswgt!0 = "lat"
coswgt&lat= obs&lat
llats = -5.
llatn = 5.
llonw = 190.
llone = 240.
aa=wgt_areaave(obs(:,{llats:llatn},{llonw:llone}),coswgt({llats:llatn}),1.0,0)

Note in your case you needn't specify latitudes or longitudes, as you want a
global average...

Good luck.
Adam

>Delivered-To: asphilli@ucar.edu
>Delivered-To: ncl-talk@ucar.edu
>Date: Fri, 18 Mar 2005 12:28:00 -0500
>From: Cathryn Meyer <cathryn.meyer@yale.edu>
>To: ncl-talk@ucar.edu
>MIME-Version: 1.0
>Content-Transfer-Encoding: 8bit
>User-Agent: Internet Messaging Program (IMP) 3.1
>X-Originating-IP: 128.36.127.47
>X-YaleITSMailFilter: Version 1.2b (attachment(s) not renamed)
>X-Virus-Scanned: amavisd-new at ucar.edu
>Subject: accounting for surface area differences when averaging
>X-BeenThere: ncl-talk@ucar.edu
>X-Mailman-Version: 2.1.1
>List-Id: NCAR Command Language User Group <ncl-talk.ucar.edu>
>List-Unsubscribe: <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>,
<mailto:ncl-talk-request@ucar.edu?subject=unsubscribe>
>List-Post: <mailto:ncl-talk@ucar.edu>
>List-Help: <mailto:ncl-talk-request@ucar.edu?subject=help>
>List-Subscribe: <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>,
<mailto:ncl-talk-request@ucar.edu?subject=subscribe>
>X-Virus-Scanned: amavisd-new at ucar.edu
>
>Hello,
>
>I have been calculating global averages of several output variables from
>CAM3.0, however I am wondering if there is a way to account for the
>differing surface areas between grid boxes of different latitudes when
>doing this averaging (for example, to make the grid boxes with smaller
>surface area contribute less to the average)? I have been using dim_avg
>for my calculations, and I do not think that this takes surface area
>into account, but I am not sure.
>
>Thanks,
>Cathy
>
>--
>Cathryn Meyer
>Department of Geology and Geophysics
>Yale University
>cathryn.meyer@yale.edu
>(203)432-1959
>_______________________________________________
>ncl-talk mailing list
>ncl-talk@ucar.edu
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-------------------------------------------------------------
Adam Phillips email: asphilli@ucar.edu
Climate and Global Dynamics Division tel: (303) 497-1726
National Center for Atmospheric Research fax: (303) 497-1333
P.O. Box 3000
Boulder, CO 80307-3000 http://www.cgd.ucar.edu/~asphilli

_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



This archive was generated by hypermail 2b29 : Fri Mar 18 2005 - 17:20:08 MST