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

Home » Public Forums » archive » Re: Selecting data from two separate arrays
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
Re: Selecting data from two separate arrays [message #71501] Tue, 22 June 2010 03:20
Fster is currently offline  Fster
Messages: 6
Registered: June 2010
Junior Member
On 21 June, 21:33, Ed Hyer <ejh...@gmail.com> wrote:
> On Jun 21, 12:57 pm, Fster <francis.colle...@live.co.uk> wrote:
>
>> Would it be easier to combine them into one array? The issue is that
>> one array is on the x and y axis, and the other is on x, y, z axis,
>> BUT the x and y axis are the same for each of the arrays and equal
>> number of grid points...
>
> So, you want to select points from the XY array, and the extract the
> corresponding data from the XYZ array, right?
>
> There are quite a few ways to do this. Here's a simple one, not the
> fastest, but the simplest code-wise:
>
> DATA2 = <XY data>
> DATA3= <XYZ data>
> ;Get size of Z dimension
> NZ=(size(DATA3))[3]
> ; pick points from the XY data
> F2 = WHERE(DATA2 ge VALUE,NF2)
> ; set up an array to hold the extracted 3D data
> DATA3_EXTRACT = FLTARR(NF2,NZ)
> ; load the data into the array
> for IZ=0l,NZ-1 do DATA3_EXTRACT[*,IZ]=(DATA3[*,*,IZ])[F2]

In IDL is last section of the last line is it indexing or multiplying?
Re: Selecting data from two separate arrays [message #71504 is a reply to message #71501] Tue, 22 June 2010 02:21 Go to previous message
Fster is currently offline  Fster
Messages: 6
Registered: June 2010
Junior Member
On 22 June, 00:35, Ed Hyer <ejh...@gmail.com> wrote:
> On Jun 21, 1:50 pm, Fster <francis.colle...@live.co.uk> wrote:
>
>> Thanks I see whats going on here, but at DATA3_EXTRACT line, it is
>> saying 'Array dimensions must be greater than 0.' and execution is
>> halted at this line.
>>> DATA3_EXTRACT = FLTARR(NF2,NZ)
>
> This means that either NF2 or NZ equals 0.
> PRINT,SIZE(DATA3) ; are the data actually 3-dimensional?
> HELP,F2 ; are there are data with DATA2 >= VALUE?

Thanks that was my error all is working brilliantly! much appreciated!
Re: Selecting data from two separate arrays [message #71509 is a reply to message #71504] Mon, 21 June 2010 16:35 Go to previous message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
On Jun 21, 1:50 pm, Fster <francis.colle...@live.co.uk> wrote:
> Thanks I see whats going on here, but at DATA3_EXTRACT line, it is
> saying 'Array dimensions must be greater than 0.' and execution is
> halted at this line.

>> DATA3_EXTRACT = FLTARR(NF2,NZ)

This means that either NF2 or NZ equals 0.
PRINT,SIZE(DATA3) ; are the data actually 3-dimensional?
HELP,F2 ; are there are data with DATA2 >= VALUE?
Re: Selecting data from two separate arrays [message #71511 is a reply to message #71509] Mon, 21 June 2010 13:50 Go to previous message
Fster is currently offline  Fster
Messages: 6
Registered: June 2010
Junior Member
On 21 June, 21:33, Ed Hyer <ejh...@gmail.com> wrote:
> On Jun 21, 12:57 pm, Fster <francis.colle...@live.co.uk> wrote:
>
>> Would it be easier to combine them into one array? The issue is that
>> one array is on the x and y axis, and the other is on x, y, z axis,
>> BUT the x and y axis are the same for each of the arrays and equal
>> number of grid points...
>
> So, you want to select points from the XY array, and the extract the
> corresponding data from the XYZ array, right?
>
> There are quite a few ways to do this. Here's a simple one, not the
> fastest, but the simplest code-wise:
>
> DATA2 = <XY data>
> DATA3= <XYZ data>
> ;Get size of Z dimension
> NZ=(size(DATA3))[3]
> ; pick points from the XY data
> F2 = WHERE(DATA2 ge VALUE,NF2)
> ; set up an array to hold the extracted 3D data
> DATA3_EXTRACT = FLTARR(NF2,NZ)
> ; load the data into the array
> for IZ=0l,NZ-1 do DATA3_EXTRACT[*,IZ]=(DATA3[*,*,IZ])[F2]

Thanks I see whats going on here, but at DATA3_EXTRACT line, it is
saying 'Array dimensions must be greater than 0.' and execution is
halted at this line.
Re: Selecting data from two separate arrays [message #71512 is a reply to message #71511] Mon, 21 June 2010 13:33 Go to previous message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
On Jun 21, 12:57 pm, Fster <francis.colle...@live.co.uk> wrote:
> Would it be easier to combine them into one array? The issue is that
> one array is on the x and y axis, and the other is on x, y, z axis,
> BUT the x and y axis are the same for each of the arrays and equal
> number of grid points...

So, you want to select points from the XY array, and the extract the
corresponding data from the XYZ array, right?

There are quite a few ways to do this. Here's a simple one, not the
fastest, but the simplest code-wise:

DATA2 = <XY data>
DATA3= <XYZ data>
;Get size of Z dimension
NZ=(size(DATA3))[3]
; pick points from the XY data
F2 = WHERE(DATA2 ge VALUE,NF2)
; set up an array to hold the extracted 3D data
DATA3_EXTRACT = FLTARR(NF2,NZ)
; load the data into the array
for IZ=0l,NZ-1 do DATA3_EXTRACT[*,IZ]=(DATA3[*,*,IZ])[F2]
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: MPFIT Chance probability
Next Topic: I/O with file lists

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

Current Time: Wed Oct 08 13:46:16 PDT 2025

Total time taken to generate the page: 0.00405 seconds