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

Home » Public Forums » archive » Re: image statistics without the NaN
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: image statistics without the NaN [message #58723] Sun, 17 February 2008 22:20 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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 the Image_statistics procedure 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.")
Re: image statistics without the NaN [message #58777 is a reply to message #58723] Thu, 21 February 2008 07:31 Go to previous message
raghuram is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Use IDL Workbench with other languages?
Next Topic: IDL & reading headers of netCDF files

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

Current Time: Wed Oct 08 19:05:07 PDT 2025

Total time taken to generate the page: 0.00447 seconds