Re: Global sum question

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Jul 01 2013 - 11:41:38 MDT

Lifen,

I'm getting a value of 4.621394e+14 when I run your script.

What version of NCL are you using, and what value are you expecting?

--Mary

On Jun 30, 2013, at 7:00 PM, Jiang, Lifen wrote:

> 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
>
>
> ***********************************
>
> 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("Regrid.med_c0_kgm-2.nc","r")
> 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=addfile(filo,"c")
> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jul 1 11:41:49 2013

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