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

Home » Public Forums » archive » Removing equal elements from an array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Removing equal elements from an array [message #49820 is a reply to message #49761] Thu, 17 August 2006 13:32 Go to previous messageGo to previous message
news.qwest.net is currently offline  news.qwest.net
Messages: 137
Registered: September 2005
Senior Member
"JD Smith" <jdsmith@as.arizona.edu> wrote in message
news:pan.2006.08.17.17.59.05.354360@as.arizona.edu...
...

> [5.5,5.5] => combo= 5505.5
> [5.2,305.] => combo= 5505.5

Good point, but I thought it was obvious to choose the correct
multiplication
factor such that the 2 numbers will not overlap. Six digits of lat
or lon will give 10 meter resolution, which is probably good enough
for many geophysical applications.
So, to be more precise:

; make data array
A = fltarr(2,9)
A[0,*]=[20.4, 40.3, 50.2, 50.2, 5.5,5.2, .2,.1,.15]
A[1,*]=[30.2, 60.2, 32.4, 32.4, 5.5, 302,10,110,60]
original_a = a

factor = 10L^6L ; 6 digits for each value
intfactor = 1000 ; take 3 decimal places, 10m resolution
a = round(a * intfactor,/l64)
combo = A[0,*]*factor + A[1,*]
result = UNIQ(combo) ; the indices

; output results
print
print, 'result'
for i = 0, n_elements(result)-1 do begin
print,original_a[*,result[i]]
endfor

end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: quickly reassign numbers in large array?
Next Topic: Re: Changing the Dec labeling from horizontal to vertical

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

Current Time: Fri Oct 10 07:27:07 PDT 2025

Total time taken to generate the page: 0.80164 seconds