Sorry for the inconvenience

From: Jiang, Lifen <lfjiang_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 24 2013 - 09:07:31 MDT

Dear Mary and others,

I apologize for any inconvenience brought by my mistake last night. I will remember to create a new subject later for a new question.

Thank you for your kind reply, Mary.

Have a great day!

Lifen


2013-04-24



Jiang, Lifen



发件人: Mary Haley
发送时间: 2013-04-24 09:59:13
收件人: Jiang, Lifen
抄送: ncl-talk@ucar.edu
主题: Re: [ncl-talk] NCL is getting slower when I call "user defined function" many times
 
Hi Lifen,


My apologies, I see that you did post your question with a different subject. I didn't realize the other email was the same one.


Dennis' answer about the ordering of the latitudes mostly likely the correct one. Hopefully the information below will be useful some other time!


--Mary


On Apr 24, 2013, at 8:53 AM, Mary Haley <haley@ucar.edu> wrote:


Dear Lifen,


Please use a new subject when you ask a new question.


Just by looking at your code I can't tell why you might be getting "Inf". My first guess is that you have some Inf's in the data you read off the file.


You can check this by using the "isnan_ieee" function:


http://www.ncl.ucar.edu/Document/Functions/Built-in/isnan_ieee.shtml


print(any(isnan_ieee(t))) ; Will print "True" if you have any Infs in your data
print(any(isnan_ieee(lat)))
print(any(isnan_ieee(lon)))


If you find some Infs in your code (Nan), then you can use the replace_ieeenan function to replace these with missing values:


http://www.ncl.ucar.edu/Document/Functions/Built-in/isnan_ieee.shtml


if (any(isnan_ieee(t))) then
      t@_FillValue = default_fillvalue(typeof(t)) ; only necessary if "t" doesn't have a _FillValue
      replace_ieeenan (t, t@_FillValue, 0)
  end if




Also, instead of this code:


wgt = new((/1676, 4320/), typeof(t))
wgt = conform(wgt, dxdy, 0)


you can use "conform_dims":


wgt = conform_dims((/1676,4320/), dxdy, 0)


If you still have problems, it will help if you can provide your data file.


--Mary


On Apr 23, 2013, at 10:24 PM, "Jiang, Lifen" <lfjiang@ou.edu> wrote:


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



_______________________________________________
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 Wed Apr 24 09:07:49 2013

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