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

Home » Public Forums » archive » Re: NULL value in IDL ?
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: NULL value in IDL ? [message #42317] Wed, 02 February 2005 07:03
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
In article <ctq3og$76u$2@news.u-strasbg.fr>,
Jerome Colin <jcolin@ulp.u-strasbg.fr> wrote:

> search=WHERE(data le 0.) & data(search)=!values.f_NaN
>
> And if I use :
>
> search=WHERE(newdata eq !values.f_nan)
>
> it returns -1.
>
> What kind of operator can be used to identify NaN cells in my array ?

You need to use

i = WHERE(~FINITE(newdata), count)
IF (count GT 0) THEN newdata[i] = 0

Cheers, Ken Bowman
Re: NULL value in IDL ? [message #42320 is a reply to message #42317] Wed, 02 February 2005 00:58 Go to previous message
Jerome Colin is currently offline  Jerome Colin
Messages: 8
Registered: February 2005
Junior Member
Jerome Colin wrote:
> David Fanning wrote:
>
>> Jerome Colin writes:
>>
>>> Is there in IDL a way to give a variable the value NULL, meaning 'no
>>> data' ?
>>> My problem is that I use REBIN() to reduce an image, but some parts
>>> of this image do not contain information, even is the value is zero.
>>> These zero-value pixels are hence taken into account in the REBIN()
>>> calculation, and that's what I would like to avoid.
>>
>>
>> REBIN seems to work OK with NANs:
>>
>> a = findgen(5, 5)
>> a[1,1] = !Values.F_NAN
>> b = Rebin(a, 10, 10)
>> print, b
>>
>> Cheers,
>>
>> David
>>
> Ok, now I replace values of the array with !values.f_NaN, it work properly.
> But at the end, I use a WRITE_BMP() to have a look at the result. NaN
> values cause a failure, so I tried to replace NaN values with 0. Has the
> array dimensions have changed, I cannot use the index array I previoulsy
> used :
>
> search=WHERE(data le 0.) & data(search)=!values.f_NaN
>
> And if I use :
>
> search=WHERE(newdata eq !values.f_nan)
>
> it returns -1.
>
> What kind of operator can be used to identify NaN cells in my array ?
>
> Many thanks, David !
>
> Jerome
Oups... Forget my question, I've found your answer on your web site, in
math tips 'finding NaN in arrays'.
Thank you for your help.
Jerome
Re: NULL value in IDL ? [message #42321 is a reply to message #42320] Wed, 02 February 2005 00:28 Go to previous message
Jerome Colin is currently offline  Jerome Colin
Messages: 8
Registered: February 2005
Junior Member
David Fanning wrote:
> Jerome Colin writes:
>> Is there in IDL a way to give a variable the value NULL, meaning 'no data' ?
>> My problem is that I use REBIN() to reduce an image, but some parts of
>> this image do not contain information, even is the value is zero. These
>> zero-value pixels are hence taken into account in the REBIN()
>> calculation, and that's what I would like to avoid.
>
> REBIN seems to work OK with NANs:
>
> a = findgen(5, 5)
> a[1,1] = !Values.F_NAN
> b = Rebin(a, 10, 10)
> print, b
>
> Cheers,
>
> David
>
Ok, now I replace values of the array with !values.f_NaN, it work properly.
But at the end, I use a WRITE_BMP() to have a look at the result. NaN
values cause a failure, so I tried to replace NaN values with 0. Has the
array dimensions have changed, I cannot use the index array I previoulsy
used :

search=WHERE(data le 0.) & data(search)=!values.f_NaN

And if I use :

search=WHERE(newdata eq !values.f_nan)

it returns -1.

What kind of operator can be used to identify NaN cells in my array ?

Many thanks, David !

Jerome
Re: NULL value in IDL ? [message #42323 is a reply to message #42321] Tue, 01 February 2005 11:30 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jerome Colin writes:

> Is there in IDL a way to give a variable the value NULL, meaning 'no data' ?
> My problem is that I use REBIN() to reduce an image, but some parts of
> this image do not contain information, even is the value is zero. These
> zero-value pixels are hence taken into account in the REBIN()
> calculation, and that's what I would like to avoid.

REBIN seems to work OK with NANs:

a = findgen(5, 5)
a[1,1] = !Values.F_NAN
b = Rebin(a, 10, 10)
print, b

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: VoIP User Group
Next Topic: How to keep image ratio in Shade_surf

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

Current Time: Sat Oct 11 07:48:25 PDT 2025

Total time taken to generate the page: 0.47968 seconds