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

Home » Public Forums » archive » Re: Filtering out 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: Filtering out NaNs [message #8515 is a reply to message #8502] Thu, 20 March 1997 00:00 Go to previous messageGo to previous message
f055 is currently offline  f055
Messages: 29
Registered: April 1995
Junior Member
-> |> There are some NaNs in my data which keep making my code fall over.
-> |> I'd like to either filter them out or avoid them in the calculation,
-> |> but doing something like
-> |>
-> |> a(where(a eq !values.f_nan) = missing_flag
-> |>
-> |> doesn't work. Does anyone have any suggestions?
-> |>
->
-> NaNs are characterized by the fact that they are *not* equal
-> to any number (that's what it says, isn't it :-)
->
-> In fact, it's not even equal to itself - and this is the distinguishing
-> feature that must be used to pick them out. I.e.,
->
-> a(where(a ne a)) = missing_flag
->

Somewhat less confusing, perhaps, to someone who later tries to debug/modify
your code might be:

a(where(finite(a) eq 0)) = missing_flag

finite returns true (ne 0) only for numbers and not for things that are
"Not a Number" (or is it "Not a Numerical Quantity" = NanQ ?)

Tim


......................... Dr Tim Osborn . t.osborn@uea.ac.uk
.... ___/.. __ /.. /.. /. Senior Research Associate . phone:01603 592089
... /..... /. /.. /.. /.. Climatic Research Unit . fax: 01603 507784
.. /..... __/.. /.. /... School of Environmental Sciences.
. /..... /\ ... /.. /.... University of East Anglia .
____/.._/..\_..____/..... Norwich NR4 7TJ .
......................... UK .
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Time Series Analysis
Next Topic: Re: Anything better than ANNOTATE?

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

Current Time: Fri Oct 10 11:07:26 PDT 2025

Total time taken to generate the page: 0.96109 seconds