Re: possible bug with gc_latlon

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Feb 10 2011 - 10:20:02 MST

THX ... To my knowledge we do not have access to an XE6.
Still, we could add some code that checks if
[rlat1,rlon1] are exactly equal to [rlat2,rlon2] and, if so.
return 0.0

Cheers

On 02/09/2011 06:15 PM, Matthew Higgins wrote:
> 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

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Feb 10 10:20:15 2011

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