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

Home » Public Forums » archive » Re: using the WHERE function on a portion of 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: using the WHERE function on a portion of an array [message #59029] Tue, 04 March 2008 12:15 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
> I thought this could be done via a WHERE function call, such as:
> indices = WHERE(A[0,*,*] ge 4 AND A[0,*,*] lt 5, count)

so, indices refers to A[0,*,*], which is a 2D array.


> if count gt 0 then C[4,indices] = B[0,indices]

Now you are try to apply your 2D array in a 3D one, which can not work
properly.
To access your 3D array, you must either have a 3D index, or have a 1D
index.

So in your case, you want to write in C, on the 5th plane:
indices1D_C = indices + (n_elements(C[0,*,*]) * 4
And you want to read B on the 1st plane:
indices1D_B = indices

and then C[indices1D_C] = B[indices1D_B]


Jean

> On the other hand, if I set each level I am looking at to its own 2d
> array, i.e.,
> leva = A[0,*,*]
> levb = B[0,*,*]
> levc = C[4,*,*]
> use these values in the same code written above, and add the statement
> at the end that C[4,*,*] = levc, then it works just fine. However, A
> and B are actually very large, so this isn't an option.
>
> I'm guessing I do not understand some key part of the WHERE function.
> Would someone please shine some light on this for me? Thanks in
> advance.
> Becky
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Expensive loops... can they be avoided?
Next Topic: itools (mouse) events

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

Current Time: Wed Oct 08 13:33:21 PDT 2025

Total time taken to generate the page: 0.00984 seconds