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)
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Apr 23 22:24:59 2013
This archive was generated by hypermail 2.1.8 : Fri Apr 26 2013 - 17:10:26 MDT