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

Home » Public Forums » archive » Re: max, mean, min of 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: max, mean, min of array [message #28924 is a reply to message #28687] Wed, 23 January 2002 07:04 Go to previous messageGo to previous message
Alex Schuster is currently offline  Alex Schuster
Messages: 124
Registered: February 1997
Senior Member
Wayne Landsman wrote, a while ago:

> Dinh Huong wrote:

>> I have an array of 400,400,10 contains 10 month T� of 400x400 pixel
>> area. I am trying to calculate min, max, mean T�for each pixel and
>> output is 400x400 image. How to solve this by IDL?
>> Any help will be appreciate,
>
> In IDL V5.5, if you have a 400 by 400 by 10 array, you can find the
> maximum over the 3rd dimension using the DIMENSION keyword.
>
> IDL> pixmax = max(array, dimen=3) ;Return a 400 x 400 array
>
> In earlier versions of IDL you have to loop over each pixel, and (as
> David mentioned) Craig Markwardt's CMAPPLY will make sure that this
> looping is done as efficiently as possible.

It's possible without, um, with fewer loops:

zdim = (size( array, /dimension ))[2]
pixmin = ( pixmax = array[*,*,0] )
for i = 1, zdim-1 do begin
pixmax = pixmax > array[*,*,i]
pixmin = pixmin < array[*,*,i]
endfor
pixmean = total( array, 3 ) / zdim

Hey Craig, I think with this method you can get rid of your ho, hum
comment in cmapply.pro.

Alex
--
Alex Schuster Wonko@planet-interkom.de
alex@pet.mpin-koeln.mpg.de
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Urgent object question
Next Topic: Urgent object question

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

Current Time: Wed Oct 08 14:58:13 PDT 2025

Total time taken to generate the page: 0.00244 seconds