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

Home » Public Forums » archive » Using where() on slices of data cubes
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 where() on slices of data cubes [message #68463 is a reply to message #68346] Wed, 21 October 2009 15:20 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
JD Smith writes:

>
> On Oct 20, 4:32 pm, David Fanning <n...@dfanning.com> wrote:
>> JD Smith writes:
>>> you should easily be able to generalize the above arguments to access
>>> these elements
>>
>> I think in this case the word "easily" might be
>> too subtly sarcastic to be easily appreciated by
>> the vast majority of this newsgroup. :-)
>
> (Almost) no sarcasm was intended.
>
> Suppose you have this:
>
> w=where(cube[1,5:*,10:1024] lt 0)
>
> The "slice" is no longer as large as the cube in the yz dimensions,
> and is offset by [5,10] too. So
>
> y_full_cube = slice_column + 5
> z_full_cube = slice_row + 10
>
> and since the slice is smaller than the cube by 5 columns, to convert
> our WHERE index vector w into col,row in the slice, we use
>
> slice_column = w mod (sz[1]-5)
> slice_row = w/(sz[1]-5)
>
> Putting it all together we have:
>
> ind = 1 + sz[0] * (5 + w mod (sz[1]-5) + (10 + w/(sz[1]-5)) * sz[1])

Ah, OK. Even Coyote seems to be catching on now. ;-)

I'm curious if you have a method to test these indices?

Those of us unused to typing (I would say *most* of us,
but I don't want to offend anyone) would find it a challenge,
probably, to type a line of code like this and get it right.

How did you test this code to know it was correct?

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Creating Transparent PNG Images
Next Topic: changing window focus with cusor on x-windows

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

Current Time: Sun Oct 12 13:50:07 PDT 2025

Total time taken to generate the page: 0.24332 seconds