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 #33374 is a reply to message #33372] Thu, 26 December 2002 08:25 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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: Fri Oct 10 00:26:23 PDT 2025

Total time taken to generate the page: 1.04195 seconds