Re: Initialize new variable array with nan or -9999 values [message #87663 is a reply to message #87653] |
Fri, 21 February 2014 06:47   |
John Correira
Messages: 25 Registered: August 2011
|
Junior Member |
|
|
On 02/20/2014 08:36 PM, Heinz Stege wrote:
> IDL> t0=systime(1) &for i=0,9 do a=fltarr(1000,1000,100)-9999.
> &print,systime(1)-t0 &help,a
> 1.8280001
> A FLOAT = Array[1000, 1000, 100]
> IDL> t0=systime(1) &for i=0,9 do
> a=make_array(1000,1000,100,value=-9999.) &print,systime(1)-t0 &help,a
> 2.7969999
> A FLOAT = Array[1000, 1000, 100]
> IDL> print,!version
> { x86 Win32 Windows Microsoft Windows 8.0.1 Oct 5 2010 32
> 64}
MAKE_ARRAY is faster on my machine:
IDL> tic
IDL> for i=0,9 do a=fltarr(1000,1000,100)-9999.
IDL> toc
IDL> help, a
Elapsed time is 3.018326s
A FLOAT = Array[1000, 1000, 100]
IDL> tic
IDL> for i=0,9 do a=make_array(1000,1000,100,value=-9999.)
IDL> toc
IDL> help, a
Elapsed time is 2.075103s
A FLOAT = Array[1000, 1000, 100]
IDL> print,!version
{ x86_64 linux unix linux 8.2 Apr 10 2012 64
64}
|
|
|