Re: Problem with wgt_areasum2

From: Jiang, Lifen <lfjiang_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 24 2013 - 08:49:04 MDT

Dear Dennis,

Thank you for your quick reply and the instructions! That might be the problem. I will try.

Best,

Lifen


2013-04-24



Jiang, Lifen



发件人: Dennis Shea
发送时间: 2013-04-24 09:43:08
收件人: Jiang, Lifen
抄送: ncl-talk
主题: Re: [ncl-talk] Problem with wgt_areasum2
 
Speculation:
[1] Your data goes from N->S. Hence, (lat(2) - lat(1))
     is a negative number and will lead to negative dx. Try
            abs(lat(2) - lat(1))
[2] Try the attached
On 04/24/2013 08:00 AM, Jiang, Lifen wrote:
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> in = addfile("med_c0_kgm-2.nc","r")
> t = in->y
>
> t = lonFlip(t)
> printVarSummary(t)
>
> lat = in->lat
> lon = in->lon
>
> re = 6.37122e06
> rad = 4.0 * atan(1.0) / 180.0
> con = re * rad
> clat = cos(lat * rad) ; cosine of latitude
>
> dlon = (lon(2) - lon(1)) ; assume dlon is constant
> dlat = (lat(2) - lat(1)) ; assume dlat is constant
>
> dx = con * dlon * clat ; dx at each latitude
> dy = con * dlat ; dy is constant
> dxdy = dx * dy ; dxdy(nlat)
> dydx = dy * dx ; dydx(nlat)
>
> wgt = new((/1676, 4320/), typeof(t))
> wgt = conform(wgt, dxdy, 0)
>
> qSum = wgt_areasum2(t, wgt, 0) ; => qSum
> print(qSum)
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Apr 24 08:49:20 2013

This archive was generated by hypermail 2.1.8 : Fri Apr 26 2013 - 17:10:25 MDT