Re: mask northern or southern hemisphere

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 05 2011 - 09:43:38 MDT

[1] You NCL code is correct. It is slightly more efficient to use

     Twgt = sum(data*cwgt)/wsum

     rather than

     Twgt = sum(data(:,:)*cwgt)/wsum

[2] NH: cwgt_nh = where(clat.gt.0, cwgt, 0.0)
     SH: cwgt_sh = where(clat.lt.0, cwgt, 0.0)

     You should half the equator weights

     cwgt_nh = where(clat.eq.0, 0.5*cwgt, cwgt_nh)
     cwgt_sh = where(clat.eq.0, 0.5*cwgt, cwgt_sh)

[3] NCL has a 1x1 deg mask available. See:
      http://www.ncl.ucar.edu/Applications/mask.shtml
      Example 5

On 04/05/2011 08:26 AM, Mark Chan wrote:
> NCL users
>
> Below is a piece of NCL script for calculating area weighted average over "land"
> region with a mask data "ecmask". As I understand one has to mask both "data"
> and "clat" (latitude for weight calculation) for correct calculation. If my
> understanding is wrong, or there is an alternative method, please kindly let me
> know.
>
>
> In addition, without a specific mask file like "ecmask" here, can one do similar
> area weighted calculation for northern or southern hemisphere? or one has to
> make a "mask" file for distinguishing northern and southern hemiphere.
>
> clat=conform(data,lat,0)
> data=mask(data,ecmask,1) ; for Land
> clat=mask(clat,ecmask,1) ; for Land
> cwgt = cos(0.01745329*clat)
> wsum = sum(cwgt)
> Twgt = sum(data(:,:)*cwgt)/wsum
>
>
> Thanks a lot!
> Mark
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Apr 5 09:43:44 2011

This archive was generated by hypermail 2.1.8 : Fri Apr 08 2011 - 09:34:26 MDT