Re: image statistics without the NaN [message #58777 is a reply to message #58723] |
Thu, 21 February 2008 07:31  |
raghuram
Messages: 32 Registered: February 2008
|
Member |
|
|
On Feb 17, 10:20 pm, David Fanning <n...@dfanning.com> wrote:
> raghuram writes:
>> Here's the problem :
>
>> I wrote an IDL script to compute basic statistics of a MODIS image
>> that i have processed.
>> The areas outside my study area have been set to NaN because i don't
>> want them to be considered
>> while computing statistics in ENVI.
>> But, when i use theImage_statisticsprocedure in IDL, i'm not able to
>> ignore the NaN and hence all the
>> basic stats show values of NaN( like max=NaN, min= NaN etc..)
>
>> Expected result:
>> To calculate the true max,min values of the image without considering
>> the pixels which are set to NaN.
>
>> Anybody has any idea how to go about fixing this problem ? my initial
>> thought was to create a NaN mask, but
>> i want to get some ideas flowing.
>
> I should think something like this will work:
>
> IDL>Image_Statistics, image, Mask=Finite(image), MIN=min, MAX=max
>
> Well, except that this program seems strangely written, in that the mask
> must be a named variable for some reason. So try this:
>
> IDL> mask = Finite(image)
> IDL>Image_Statistics, image, Mask=mask, MIN=min, MAX=max
>
> Cheers,
>
> David
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming (www.dfanning.com)
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")- Hide quoted text -
>
> - Show quoted text -
Hi David,
The method worked !
Thanks.
Raghu
|
|
|