# Global sum question

From: Jiang, Lifen <lfjiang_at_nyahnyahspammersnyahnyah>
Date: Sun Jun 30 2013 - 19:00:17 MDT

Hi, NCL group,

I have used a NCL function to calculate the global sum of my data of two dimensions. However, my global sum (462) is a little lower than another report using different language.

Could anyone help check if my result is correct? I have uploaded my data file (Regrid.med_c0_kgm-2) to NCL folder "incoming" and attached codes below.

Thank you in advance for your time!

With best regards,

Lifen

***********************************

t = in->regrid

fili = "Regrid.med_c0_kgm-2.nc"
a = addfile (fili, "r")
t=a->regrid
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((/180, 360/), typeof(t))
wgt = conform(wgt, dxdy, 0)

qSum = wgt_areasum2(t, wgt, 0) ; => qSum
print(qSum)

filo = "GlobalSum_"+fili
system("/bin/rm -f "+filo)
fout@creation_date = systemfunc("date")
fout@title=" GlobalSum "+fili
fout->qSum=qSum

2013-06-30

Jiang, Lifen

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Jun 30 18:00:29 2013

This archive was generated by hypermail 2.1.8 : Mon Jul 01 2013 - 12:35:42 MDT