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

Home » Public Forums » archive » Finding NaNs in arrays - Strange outcome
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: Finding NaNs in arrays - Strange outcome [message #92383 is a reply to message #92382] Sat, 05 December 2015 06:38 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
dmfl0590@gmail.com writes:

>
> Hello
>
> I have a 3D array A ( A FLOAT = Array[480, 480, 160]). I wanted to check for NaNs so I had split one 2D array as follows:
>
> A1 = total(A[0:79, 0:79,25])
> A2 = total(A[80:159,80:159,25])
> A3 = total(A[160:239,160:239,25])
> A4 = total(A[240:319,240:319,25])
> A5 = total(A[320:399,320:399,25])
> A6 = total(A[400:479,400:479,25])
>
> print, 'A1', A1
> print, 'A2', A2
> print, 'A3', A3
> print, 'A4', A4
> print, 'A5', A5
> print, 'A6', A6
>
> print, 'total',total(A[*,*,25])
>
> PRINT, 'sum',A1+A2+A3+A4+A5+A6
>
> I got the following print results:
> A1 682066.
> A2 1.51149e+007
> A3 9.41048e+006
> A4 9.07705e+006
> A5 1.18558e+007
> A6 62705.1
> total NaN
> sum 4.62031e+007
>
>
> Why the total(A[*,*,25]) gave me NaN? Isn't the same thing as the sum?
>
> Can anyone help with this?

The way to find NaNs in arrays is to use the Finite function:

http://www.idlcoyote.com/math_tips/nans.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ROI of 3D volumes (multiple 2D slices)
Next Topic: Re: IDL_IDLBRIDGE undefined procedure problem

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

Current Time: Wed Oct 08 13:58:04 PDT 2025

Total time taken to generate the page: 0.00371 seconds