Re: Help on comparing 2 arrays [message #70641 is a reply to message #70635] |
Mon, 26 April 2010 19:48   |
Aram Panasenco
Messages: 41 Registered: April 2010
|
Member |
|
|
Dave Poreh wrote:
> Folks
> I am trying to compare on ground (on sea!) laser data with MERIS data
> for chlorophyll. Actually I have 2 arrays L[lat1, long1, c1] for on
> ground measurements (with 400 meters resolution) and C[lat2, long2,
> c2] for satellite data. What I want is this: for each pixel of C
> (satellite data) extract data from array L that dropped inside of this
> pixel. For instance for some pixels I have 3 or 4 data from L or
> whatever. Does anyone have some good idea how to do this?
> Any help highly appreciated.
> Cheers
> Dave
Hey Dave,
Are the latitude-longitude arrays in integer or floating-point format?
Either way, you might want to specify an extraction radius - how close
to each other do two points have to be to count them as the same point?
I would define DELTA_LAT and DELTA_LON constants for that at the start
of the routine.
Note: I see your arrays are in the format [latitude,longitude], so I
will stick with that, but the normal convention is obviously
[longitude,latitude]
I would then sort the L array in ascending latitude and ascending
longitude orders:
sortL_Lat = sort(L[0,*])
sortL_Lon = sort(L[1,*])
Then run a for-loop for every point in C and determine the indices of L
where the point falls within the latitude range AND the longitude range.
That gives you the indices of where to extract your L data for each
point and do whatever you want with it.
If the radius calculations have to be a little more precise than that,
you can use the MAP_2POINTS routine on the points obtained using
delta-longitude and delta-latitude comparison, and throw away the ones
that are farther than some radian value away. Don't forget that the
MAP_2POINTS routine accepts data in the longitude,latitude format as
opposed to your data format! ;)
Good Luck!
~Aram Panasenco
|
|
|