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

Home » Public Forums » archive » Re: WHERE - problem
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: WHERE - problem [message #33780 is a reply to message #33772] Tue, 28 January 2003 09:48 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Tue, 28 Jan 2003 03:22:04 -0700, Thomas Jordi wrote:

> hi there
> i'm not an IDL-guru, but i'm using it for some time. the WHERE function
> is extremely handy and often of great use for me. however, one problem i
> failed to solve. lets state an array(500,500,10)
> array=INDGEN(500,500,10)
>
> so then, the find=WHERE(array[*,*,1] GT 252000) returns me all the
> needed values.
> but HOW do interact with these.
>
> a=mean(array[find]) doesnt do it right
>
> So I helped myself with
> idiotway=array[*,*,1]
> find=where(idiotway gt 252000)
> so then the example a=mean(idiotway(find)) does it right.
>
> However, somehow there must be a better way...
>
>
> some help would be appreciated


A few possibilities:


IDL> m=mean(array[wh+product((size(array,/DIMENSIONS))[0:1])]) ; v5.6

or

IDL> s=size(array, /DIMENSIONS)
IDL> m=mean(array[wh+s[0]*s[1]]) ; < v5.6

Nearly equivalent to your idiot way, but much easier on the eye:

IDL> m=mean((array[*,*,1])[wh])

The last is probably the best choice, unless you are indexing extremely
large arrays and don't want the overhead of creating the plane (in
parentheses) separately.

Good luck,

JD
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Simple overflow error
Next Topic: Re: Simple overflow error

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

Current Time: Fri Oct 10 11:16:16 PDT 2025

Total time taken to generate the page: 0.32188 seconds