Problem with wgt_areasum2

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

Sorry last night I posted this question under wrong subject (reply other's email). Here I re-post it under my own subject:
Dear NCL members,
I was calculating the global sum for my carbon data (lat and lon) using the below codes. While they worked well for most of my data files, there was problems with some of my data files. It returned "inf" instead of specific value (global sum).
Could you please help take a look at what is the problem with the code?
I greatly appreciate your time!
Lifen
Codes:
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)

2013-04-24

Jiang, Lifen

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

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