|
Re: smooth function with nan keyword but still getting "Floating illegal operand" messages [message #64326 is a reply to message #64323] |
Sat, 20 December 2008 19:40  |
jkj
Messages: 48 Registered: April 2007
|
Member |
|
|
On Dec 20, 9:49 am, FÖLDY Lajos <fo...@rmki.kfki.hu> wrote:
> 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. :-)
Thanks Lajos... of course, the [5.5] manual says nothing about MISSING
as a keyword and my missing data are marked as NaN values... setting
EDGE does resolve the error message without changing the results of
smoothing... I'm taking care of the edge values explicitly in how the
array is built but can see that that is pointless and I should just
use EDGE, although I don't really understand internally, form the doc
description, why setting EDGE would eliminate those messages. No
error message appears in the degenerate case of a vector consisting
entirely of NaN values!
Very cool and thanks again!
-Kevin
|
|
|