Re: manipulating structures [message #53373 is a reply to message #53372] |
Fri, 06 April 2007 19:59  |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article <1175911428.077370.279650@n59g2000hsh.googlegroups.com>,
"metachronist" <rkombiyil@gmail.com> wrote:
> a=fltarr(dim) ;dim is dimension, i.e., #days * #data/day
The preceding line is unnecessary, as the following line will create
the array "a" automatically.
> a=float(data[*].mydat) ;data[dim].mydat is data variable
> a[where(a[*] eq 999999.)]=!values.f_nan
The line above is not a great idea, though, as it will crash when there are no
missing data. Plus, the [*] is unnecessary. You should do something like
this instead
i = WHERE(a EQ 999999.0, count)
IF (count GT 0) THEN a[i] = !VALUES.F_NAN
Other than that, the concept seems fine. You have to create a
FLOAT variable in order to use NaNs, which I heartily endorse.
The only alternative is to create the original data structure using a
FLOAT instead of a LONG (presumably when you read the data). I prefer to replace
missing data codes with NaNs at the point I read the data. That way I
don't use them inadvertently.
Ken Bowman
|
|
|