jujo@[EMAIL PROTECTED]
writes:
> I have a multi-bands image. I need to calculate the mean value of each
> pixel, considering all the bands. It can be easily done using:
>
> mean_image=total(multi_bands_image, 3) / number of bands
>
> However, I have some nan values, which have to be discarded before the
> calculation. I can do that:
>
> mean_image=total(multi_bands_image, 3, /nan) / number of bands
>
> However, if I do that, the nan values become zeros and the average
> includes them. How can I do to calculate the mean without considering
> nan values?
Seems to me you want this:
mean_image=total(multi_bands_image, 3, /nan) / total(finite(a),3)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Se****e ma de ni thui. ("Perhaps thou speakest truth.")


|