[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MAKE_ARRAY question



Paul van Delst wrote:
> One could also do:
> 
>   x = MAKE_ARRAY( n_pts, VALUE = 0.0, DOUBLE = double )
> 
> i.e value = float if double is not set, but I want to avoid the value assignation. The
> array can be quite large (many millions of points x 2) hence the /NOZERO. The performance
> hit of using the VALUE keyword is noticeable (the /NOZERO has no effect if VALUE is used).

if keyword_set(double) then $
  x = dblarr(npts, /nozero) else $
  x = fltarr(npts, /nozero)

OR

x = keyword_set(double) ? dblarr(npts, /nozero) : fltarr(npts, /nozero)

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley