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

Home » Public Forums » archive » Remove the repeated lines in my 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: Remove the repeated lines in my array... [message #93986 is a reply to message #93983] Tue, 13 December 2016 09:22 Go to previous messageGo to previous message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
Am 13.12.2016 um 16:37 schrieb dave poreh:
> I have an array (24*300,000) and it is lon-lat with some
> specification (24 characteristics). Some of these lines are repeated
> numbers. I mean same lon-lat and same specifications. I just want to
> know how could i remove the repeated lines in my array,
the following functions are untested

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

function uniq_multi, array
ords=ulonarr(24,300000)
for i=0,23 do ords[i,*]=ord(array[i,0])
maxO=max(ords,dim=2)
idx=ulon64arr(300000)
for i=0,23 do idx=idx*maxO[i]+ords[*,i]
return, array[*,uniq(idx,sort(idx))]
end


if you run into an overflow for idx, then you could print each of the
lines into an element of an array of strings and then use

array[*,uniq(idx,sort(stringarray))]

I hope one of these approaches works or can be made to work,
Good luck,
Markus
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: FYI: What's New in IDL 8.6
Next Topic: subscript and superscript in postscript file

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

Current Time: Wed Oct 08 18:03:34 PDT 2025

Total time taken to generate the page: 0.00482 seconds