Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Matching Lat, Lons in two arrays

0 views
Skip to first unread message

wilsona

unread,
Aug 26, 2008, 11:43:32 AM8/26/08
to
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.

0 new messages