Re: Initialize new variable array with nan or -9999 values [message #87645 is a reply to message #87638] |
Thu, 20 February 2014 13:33   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
On 02/20/14 13:36, John Correira wrote:
> On 02/20/2014 01:31 PM, Morgan Silverman wrote:
>> Hello,
>>
>> This seems like it should be so simple but I can't figure out how to
>> do it. I am creating a new array, distance=fltarr(304,336,500) and I
>> want it to be initially filled with either nan or -9999. My results
>> could possibly be 0.0 so I need to know where those are calculated
>> values and not just part of the original array. Thank you.
>>
>> Sincerely, Morgan
>>
>
> Either
>
> distance = fltarr(304,336,500,/NOZERO)
> distance[*] = !values.f_nan
>
> or
>
> distance = make_array(304,336,500,/FLOAT,VALUE=!values.f_nan)
+1 on the MAKE_ARRAY for this purpose.
It's more self-documenty (IMO).
|
|
|