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

Home » Public Forums » archive » Re: operation with array of NaNs
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: operation with array of NaNs [message #52436 is a reply to message #52432] Wed, 31 January 2007 15:10 Go to previous messageGo to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
don't use n_elements on the result of where, but the counter IN where...

a= [1,2,3]
b = where(a eq 10, counter)

print, b ==> -1
print, n_elements(b) ==> 1
print, counter ==> 0

Jean

inardello@odu.edu wrote:
> Hello there,
>
> I am quite new to IDL and found an interesting problem.
>
> I have an array of elements (5x5).
> All the elements in the array are NaN(s).
>
> When I ask what is the number of locations (n_elements) where the
> elements of this array are e.g.: "finite", the answer is "1".
>
> If the array contains 1 finite elements (and the rest is Nan(s)), the
> answer to the same question is still "1".
> If the array contains 2 finite elements, the answer to the same
> question is (finally..) "2".
>> From there we progress normally.
>
> So why can't I have an answer "0" when the array is only filled with
> NaNs?
>
> The same problem appears with other forms of analysis of the same
> array. For example, "what is the number of elements greater than 10?"
> The answer is still "1"
>
> Thank you for your comments.
>
> I->
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Cutting/Exclude ROI's based on overlapping
Next Topic: netCDF/CF conventions

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

Current Time: Sat Oct 11 12:14:40 PDT 2025

Total time taken to generate the page: 0.00883 seconds