Re: smooth function with nan keyword but still getting "Floating illegal operand" messages [message #64328] |
Sat, 20 December 2008 07:49 |
Foldy Lajos
Messages: 268 Registered: October 2001
|
Senior Member |
|
|
On Sat, 20 Dec 2008, jkj wrote:
> Why would SMOOTH have a NaN keyword and still produce error messages?
> It looks like in order to get the best boxcar average of this quality
> of data without the "Floating illegal operand" messages that I will
> have to write an explicit boxcar average? any thoughts? Leaving a
> trail of these messages does nothing to build the researcher's
> confidence in the code! Apparently the SMOOTH function is internally
> still executing a division even when no valid elements exist within
> the boxcar.
>
> Thanks,
> -Kevin
>
SMOOTH uses a sliding window, so everything will be a NaN after the first
NaN if NAN is not set. If it is set, there is still the possibility that
all values in a window are NaNs, resulting in 0/0, which is NaN again.
SMOOTH uses the MISSING value for these cases (which defaults to NaN).
Also, you should use EDGE_TRUNCATE to eliminate NaNs at the edges. So,
use something like
x=smooth(mydata, 5, /nan, missing=0, /edge)
regards,
lajos
ps: I know this from the IDL manual. :-)
|
|
|