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

Home » Public Forums » archive » Re: Setting values to NaN
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: Setting values to NaN [message #39928 is a reply to message #39927] Fri, 25 June 2004 08:50 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Matt wrote:
> OK I spotted it. F_NAN and D_NAN apply to floats.
>
> So is there an alternative I can use with integers?

How would you define a bit pattern for an invalid integer that's not a valid integer?, as
opposed to some user-set value (like -99 or or -32767 or -2147483647L etc.) ?

You need to define some user-set value (like -99 or or -32767 or -2147483647L etc.) based
on what you knwo about your data. Something like:

IDL> MY_INVALID_INTEGER = -32767
IDL> a = indgen(10)
IDL> lt5 = where(a lt 5)
IDL> a[lt5] = MY_INVALID_INTEGER
IDL> print, a
-32767 -32767 -32767 -32767 -32767 5 6 7 8 9

Be careful about mixing values/data types though:

IDL> MY_INVALID_INTEGER = -2147483647L
IDL> a = indgen(10)
IDL> lt5 = where(a lt 5)
IDL> a[lt5] = MY_INVALID_INTEGER
IDL> print, a
1 1 1 1 1 5 6 7 8 9

paulv


>
>
> matt_westmore@yahoo.co.uk (Matt) wrote in message news:<c66373b9.0406250228.f6cbaf4@posting.google.com>...
>
>> Hi,
>> I'd realy appreciate someone pointing out why I'm an idiot.
>>
>> I'm trying to set some values of an image to NaN so that they are not
>> included in further calculations but I can't seem to do it!!!
>>
>> eg:
>> a = indgen(10)
>> lt5 = where(a LT 5)
>> a(lt5) = !VALUES.F_NAN
>> %Program caused arithmetic error: Floating illegal operand
>> print, a
>> 0 0 0 0 0 5 6 7 8 9
>>
>> Cheers
>> Matt
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: inverse function of binary.pro
Next Topic: Local solar time

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

Current Time: Fri Oct 10 17:11:44 PDT 2025

Total time taken to generate the page: 1.35705 seconds