[ncl-talk] understanding function gc_pnt2gc
Dennis Shea
shea at ucar.edu
Thu Aug 10 08:12:01 MDT 2017
Hi Joe,
I have never used the '*gc_pnt2gc*' function. Hopefully, somebody will
address that function.
There us an alternative:
https://www.ncl.ucar.edu/Document/Functions/Built-in/gc_latlon.shtml
Try the following interactively
%> ncl <return>
Then enter the following
p_lat = 41.6
p_lon = -76.84
lat = (/52.9921,55.3543/)
lon = (/-168.693,-160.346/)
dist = gc_latlon(p_lat,p_lon,lat,lon,10,2)
print(dist)
Variable: dist
Type: float
Total Size: 8 bytes
2 values
Number of Dimensions: 1
Dimensions and sizes: [2]
Coordinates:
Number Of Attributes: 4
units : degrees
gclon : <ARRAY of 20 elements>
gclat : <ARRAY of 20 elements>
spacing : ( 6.551194, 5.948726 )
(0) 58.96074
(1) 53.53853
===
Cheers
D
On Wed, Aug 9, 2017 at 1:21 PM, Joe Grim <grim at ucar.edu> wrote:
> Hi,
>
> I have used the function gc_pnt2gc, but it doesn't appear to be doing what
> I think it should be doing. I assume this is because I am misunderstanding
> it. What I think it does is give the distance in degrees between a lat/lon
> point (p_lat, p_lon), and its closest approach to the great circle line
> between two other lat/lon pairs (lat[2], lon[2]: and I assume that this
> great circle line is the shortest greatest circle line between these
> lat/lon pairs.) Here is an example snippet of what I am trying to do:
>
> p_lat = 41.6
> p_lon = -76.84
> lat = (/52.9921,55.3543/)
> lon = (/-168.693,-160.346/)
> dist = gc_pnt2gc(p_lat,p_lon,lat,lon)
> print ("The distance is: " + dist)
>
> Here is the output:
> (0) The distance is: 0.105952
>
> I would expect the distance to be something around 53 degrees.
>
> Could someone please explain to me what I am misunderstanding about this
> function? And, do you know of another function that does what I am trying
> to do? (That is, find the shortest distance between a point and a line on
> the Earth.)
>
> Thank you!
>
> Joe Grim
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170810/ae339f82/attachment.html
More information about the ncl-talk
mailing list