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

Home » Public Forums » archive » Extracting array with same date, lat, long
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Extracting array with same date, lat, long [message #94382] Tue, 02 May 2017 09:40 Go to next message
michelle.tomlinson is currently offline  michelle.tomlinson
Messages: 1
Registered: May 2017
Junior Member
I have a structure of data which contains multiple reading for the same date and location. For example:

-76.4347 37.2563 9/26/2016
-76.4347 37.2563 9/26/2016
-76.4347 37.2563 9/26/2016
-76.4347 37.2563
-76.4347 37.2563
-76.4347 37.2563
-76.4347 37.2563
-76.4347 37.2563
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
-76.5069 37.2385
Re: Extracting array with same date, lat, long [message #94385 is a reply to message #94382] Wed, 03 May 2017 06:50 Go to previous message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
On 05/02/2017 06:40 PM, michelle.tomlinson@noaa.gov wrote:
> I have a structure of data which contains multiple reading for the same date and location. For example:
It's not really clear what you want, but maybe this helps:

;----- file: ord.pro
function ord, array
;+
; Calculates the ordinal of each value of an array in terms of the
; sorted values.
; inspired by jbiu's ord & uniqify
; IDL> result=ord(array)
;-
compile_opt defint32, strictarr
return, reform( value_locate(array[uniq(array,sort(array))],array),$
size(array,/dimensions),/overwrite)
end
;----- EOF

ord1=ord(lon)
ord2=ord(lat)
ord3=ord(date)
idx=ord1+(max(ord1)+1)*(ord2+(max(ord2)+1)*ord3)
ord4=ord(idx)
h=histogram(ord4,reverse_indices=ri)
for j=0,n_elements(h)-1 do begin
w=ri[ri[j]:ri[j+1]-1]
print, lon[w[0]], lat[w[0]], date[w[0]]
array=data[w,*]
;do something with the array of data for this triple of lon,lat,date
endfor

;-----
good luck, Markus
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Updated Harris Geospatial Website
Next Topic: area of symmetric differences of contours

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

Current Time: Wed Oct 08 13:37:38 PDT 2025

Total time taken to generate the page: 0.00457 seconds