comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Matching Lats and Lons from two arrays
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Matching Lats and Lons from two arrays [message #62149] Tue, 26 August 2008 08:47
wilsona is currently offline  wilsona
Messages: 2
Registered: August 2008
Junior Member
I have 2 seperate arrays of Latittudes and Longitudes.
CS_LATLON(0,4607) is one latitude array and dlat(192,139) is the
other
CS_LATLON(1,4607) is one longitude array and dlon(192,139) is the
other.
I want to index through each element in both CS_LATLON arrays and
find
which point(s) in the dlat and dlong arrays are closest.
I tried using nested loops but that gave me 12 million+ loops which
is
too many for my liking. I now am trying search2d
NUM_PNTS = N_ELEMENTS(CS_LATLON(0, *)) - 1

FOR J = 0, NUM_PNTS DO BEGIN
CLOSE_LATS = SEARCH2D(dlat, 0, 0, CS_LATLON(0,J),
CS_LATLON(0,J), INCREASE=0.5, $
DECREASE=0.5)
lat1 = CS_LATLON(0,J) * PI / 180.0
FOR K = 0, CLOSE_LATS DO BEGIN
lat2 = dlat(K) * PI / 180.0
d_long = CS_LATLON(1,J) - dlon(K)) * PI / 180.0
DISTANCE = 10800.0 / PI * acos(sin(lat1) * sin(lat2)
+
cos(lat1) * $
cos(lat2) * cos(d_long))
ENDFOR ; K
ENDFOR ; J
This is not working they way I would like. Any suggestions on this
would be greatly appreciated.
[Message index]
 
Read Message
Previous Topic: Re: Umlauts in IDL 6.0 and 7.0
Next Topic: Re: Having trouble stopping a loop (or loop de loop de loop)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 09:01:52 PDT 2025

Total time taken to generate the page: 7.44486 seconds