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

Home » Public Forums » archive » Subsetting an array with user defined values
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
Subsetting an array with user defined values [message #40144] Mon, 19 July 2004 09:10
dfinnegan is currently offline  dfinnegan
Messages: 2
Registered: October 2001
Junior Member
Hi all,

Not sure if this is a repetitive question or not.

I have a series of ascii XYX files that I am reading into IDL and
creating an array with (array[3,millions]). Importing is no problem as
well as working with the array. What I would like to do is subet the
array by a given min and max longitude and latitude so that I get back
only the values within that range, say a user defined box.

I am doing this with the following code (the data has been sorted and
nulls removed prior to this):

latmin=3763965.28
latmax=3763985.74
lonmin=534302.28
lonmax=534335.50

IF latmin GE min(data[0,*]) then begin
print, 'inside latmin'
vgood= where(data[0,*] GT latmin)
data = temporary(data[*,vgood])
ENDIF

IF latmax LT max(data[0,*]) then begin
print, 'inside latmax'
vgood= where(data[0,*] LE latmax)
data = temporary(data[*,vgood])
ENDIF

IF lonmin GE min(data[1,*]) then begin
vgood= where(data[1,*] GE lonmin)
data = temporary(data[*,vgood])
ENDIF

IF lonmax LE max(data[1,*]) then begin
vgood= where(data[1,*] LE lonmax)
data = temporary(data[*,vgood])
ENDIF


Is there a more efficient way of extracting the data from these
arrays? An example would be great!

Thanks in advance,

Dave
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Compiling IDL code with a C compiler
Next Topic: Re: Subsetting an array with user defined values

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

Current Time: Wed Oct 08 15:36:58 PDT 2025

Total time taken to generate the page: 0.00532 seconds