Re: Filtering out NaNs [message #8643 is a reply to message #8528] |
Fri, 21 March 1997 00:00  |
Christian Marquardt
Messages: 7 Registered: August 1996
|
Junior Member |
|
|
Peter Webb wrote:
>
> Stein Vidar Hagfors Haugan (steinhh@rigil.uio.no) wrote:
>
> : 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
>
> I'd like to hereby nominate Stein for the "Cool Tip of the Week" award!
Well - it will result in an error message from IDL if there are _no_
NaN's or +/-Infinites in that array. Better try something like
idx = where(a ne a) & if idx(0) ne -1 then a(idx) = missing_flag
or
idx = where(finite(a) ne 1) & if idx(0) ne -1 then a(idx) =
missing_flag
I wonder if there's a way to use where without checking if the
condition was met at all, given that you do not know this in
advance.
Regards,
Chris.
------------------------------------------------------------ ------------
Christian Marquardt
Meteorologisches Institut der | tel.: (+49) 30-838-71170
Freien Universitaet Berlin | fax.: (+49) 30-838-71167
Carl-Heinrich-Becker-Weg 6-10 | email:
marq@strat01.met.fu-berlin.de
D-12165 Berlin |
------------------------------------------------------------ ------------
|
|
|