Re: manipulating structures [message #53372 is a reply to message #53369] |
Fri, 06 April 2007 23:20   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
metachronist writes:
> To all ye who have attained idl nirvana and to the one who speaketh
> the truth :p
>
> Missing data points in my 'binary' data (coded as 32bit words) are
> denoted by large #'s, like 999999. In order "not" to plot these
> missing values, I am using !values.f_nan. But the array ought to be
> float to set it to 'NaN' directly. Besides, the type of a variable
> within a structure can't be modified.
>
> What I did was:
> --
> a=fltarr(dim) ;dim is dimension, i.e., #days *
> #data/day
> a=float(data[*].mydat) ;data[dim].mydat is data variable
> a[where(a[*] eq 999999.)]=!values.f_nan
> --
>
> It works, but I was wondering if there is a "better way" to do this?
Ken's explanation is absolutely correct, but if it is
really just the plotting of the data that is causing
you problems, I'd forget about NANs and just use the
MAX_VALUE keyword to set a value less than the "missing"
value.
PLOT, data, MAX_VALUE=999999.0 - 1
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|