| Minimum between two arrays; no, not just Min(A-B) [message #55870] |
Tue, 18 September 2007 07:19 |
leatherback
Messages: 15 Registered: November 2005
|
Junior Member |
|
|
Hi All,
I am working with time series data, and image scenes. For each point
in my time series I try to find the correct satellite scene to use. So
I have two arrays, one with dates of observations, one with image
scene dates.
These dates are in long integer (Unix timestamps).
I *could* of course replicate my image scenes array to the length of
the timeseries array, calculate the difference for each date, and find
out where it is, something along these lines:
datelist = rebin(dates, n_elements(dates),
n_elements( fixes.timestamp))
for j=0, n_elements(dates)-1 do begin
datelist[j,*] = datelist[j,*]-fixes.timestamp
endfor
Or even rebin both arrays, and substract them. En then loop through
them using the MIN / WHERE functions to find out where the minimum
diferences are.
However, this does not feel right. Besides that.. the timeseries is
potentially 100,000+ observations. Add to that a few hundred image
dates, and you are filling your memory for something quite simple.
Anybody here have a good idea how to vectorize this problem?
Cheers,
Jelle.
|
|
|
|