possible bug with gc_latlon

From: Matthew Higgins <matthew.higgins_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 09 2011 - 18:15:36 MST

Hi all,

I think I may have found a platform-dependent bug with gc_latlon. I've
found that when my input latitude and longitudes are the identical,
rather than having a 0 returned (as in a distance of 0 km between the
two points), occasionally I will get an NaN returned. I only see this
issue if I'm running on a Cray XE6 - when I run the same code on my
local linux box, I get a 0. In both cases I am running NCL 5.2.1.

Here is some example code.  NCAR NCL folks - I have uploaded the two
.nc files referenced in the code below to the CGD ftp site if you'd
like to try to replicate what I am seeing.

Matt

Here's the script:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
f1 = addfile("geo_em.d01.50km.nc", "r")
lat2d_50 = f1->XLAT_M(0,:,:)
lon2d_50 = f1->XLONG_M(0,:,:)
lat1d_50 = ndtooned(lat2d_50)
lon1d_50 = ndtooned(lon2d_50)
f2 = addfile("geo_em.d01.100km.nc", "r")
lat2d_100 = f2->XLAT_M(0,:,:)
lon2d_100 = f2->XLONG_M(0,:,:)
lat1d_100 = ndtooned(lat2d_100)
lon1d_100 = ndtooned(lon2d_100)

i = 5832
q = 23532

print("example lat/lon in 100km grid "+lat1d_100(i)+" "+lon1d_100(i))
print("example lat/lon in 50km grid  "+lat1d_50(q)+" "+lon1d_50(q))
dist = gc_latlon(lat1d_100(i),lon1d_100(i),lat1d_50(q),lon1d_50(q),2,4)
print("distance in km between these points is "+dist)

--
Matt Higgins
Cooperative Institute for Research in Environmental Sciences
University of Colorado - Boulder
(303) 735-1636
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 9 18:16:04 2011

This archive was generated by hypermail 2.1.8 : Fri Feb 11 2011 - 16:11:42 MST