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

Home » Public Forums » archive » Re: Testing for NODATA presence in a dataset
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: Testing for NODATA presence in a dataset [message #33372] Thu, 26 December 2002 12:58 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
Hmmm, you're right. This seems to be a Windows versus Unix thing. I just
tried it myself on my workstation and my laptop, both in IDL 5.4, and the
behavior under Windows was as you describe. I guess that means you have to use
the FINITE() function after all.

Looking up the documentation, I realize that the keywords /NAN and /INFINITY
were added in IDL version 5.2, so that FINITE(X,/NAN) is equivalent to X NE X,
except that it also works under Windows.

In older versions of IDL, I guess you'd have to check explicitly for infinities
to distinguish them from NaNs. Fortunately, there are only four different
infinity values, as opposed to 9E15 different NaNs.

Sorry for giving wrong information,

William Thompson


David Fanning <david@dfanning.com> writes:

> Tom McGlynn (tam@lheapop.gsfc.nasa.gov) writes and
> Bill Thompson confirms:

>> That doesn't distinguish NaN from the infinities.
>> The standard trick in any language for looking for NaN's is
>>
>> if x ne x then begin
>> print,'This is a NaN'
>> endif else ...

> Humm, well, consider this little test in IDL 5.5 or 5.6
> for Windows:

> IDL> a = [ 1.0, 2.0, !Values.F_NAN, 4.0, !Values.F_NAN ]
> IDL> print, a
> 1.00000 2.00000 NaN 4.00000 NaN
> IDL> print, a(1)
> 2.00000

> All well and good so far. Test the algorithm.

> IDL> if a(1) ne a(1) THEN print, 'NAN' ELSE print, 'Number'
> Number

> Perfect. Working fine. Now text NAN.

> IDL> print, a(2)
> NaN
> IDL> if a(2) ne a(2) THEN print, 'NAN' ELSE print, 'Number'
> Number
> % Program caused arithmetic error: Floating illegal operand

> Oh, oh. What's up with that? And a floating illegal operand to
> boot. :-(

> How about the array in general?

> IDL> print, array ne array
> 0 0 0 0 0
> % Program caused arithmetic error: Floating illegal operand

> Humm. I presume you guys have a reason for thinking
> like you do. Any insights?

> Cheers,

> David
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Phone: 970-221-0438, E-mail: david@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Can't get an cell select event
Next Topic: 3d sphere revisited

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

Current Time: Wed Oct 08 19:03:23 PDT 2025

Total time taken to generate the page: 0.00506 seconds