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

Home » Public Forums » archive » How to find second minimum and maximum in 3D 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: How to find second minimum and maximum in 3D array? [message #90357 is a reply to message #90355] Wed, 25 February 2015 13:31 Go to previous message
Harald Frey is currently offline  Harald Frey
Messages: 41
Registered: March 1997
Member
On Wednesday, February 25, 2015 at 1:25:44 PM UTC-8, Craig Markwardt wrote:
> On Wednesday, February 25, 2015 at 3:01:53 PM UTC-5, hf...@ssl.berkeley.edu wrote:
>> I have a time series of ~200 images with dimensions [X,Y]=[400,250]. My data is a UINTARR[200,400,250]. It is very easy to get the minimum and maximum for each pixel X,Y in my time series using
>>
>> res=min(array,dimension=1,max=max_val)
>> IDL> help,res,max_val
>> RES FLOAT = Array[400, 250]
>> MAX_VAL FLOAT = Array[400, 250]
>>
>> However, several pixels have 0 value or 65535 value and I want the second minimum and second maximum which are not 0 or 65535. I can do this in a for-loop, but is there a more clever and faster way?
>
> You could use WHERE() once to find the pixels that are 0 or 65535, and then set those to NAN. Then you can use min() or max() directly with the /NAN keyword to ignore NAN values.
>
> Craig

Perfect! That should really speed thing up.
Thanks a lot!
Harald
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: normal, relative and ellipse
Next Topic: Using Slither with Anaconda

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

Current Time: Wed Oct 08 19:57:09 PDT 2025

Total time taken to generate the page: 0.00414 seconds