;+ ; NAME: ; arrgen ; PURPOSE: (one line) ; generate an array of evenly spaced numbers ; DESCRIPTION: ; ; CATEGORY: ; Util ; CALLING SEQUENCE: ; arrgen, x0, x1, dx ; INPUTS: ; x0 = initial value ; x1 = final value ; dx = approximate difference between successive values ; OPTIONAL INPUT PARAMETERS: ; int = 1 if integer ; long = 1 if long ; float = 1 if float ; double = 1 if doble ; ; KEYWORD INPUT PARAMETERS: ; none ; KEYWORD OUTPUT PARAMETERS: ; none ; OUTPUTS: ; COMMON BLOCKS: ; None ; SIDE EFFECTS: ; RESTRICTIONS: ; None ; PROCEDURE: ; MODIFICATION HISTORY: ; 2005 Mar 16 Leslie Young SwRI Moved to layoung/util ;- function arrgen, x0, x1, dx, int=int, long=long, float=float, double=double if keyword_set(double) then begin nx = ceil((x1-x0)/dx) + 1 x = x0 + dindgen(nx)*dx return, x end if keyword_set(float) then begin nx = ceil((x1-x0)/dx) + 1 x = x0 + findgen(nx)*dx return, x end if keyword_set(long) then begin i0 = floor(x0) i1 = ceil(x1) nx = ceil((i1-i0)/dx) + 1 x = i0 + lindgen(nx)*dx return, x end if keyword_set(int) then begin i0 = floor(x0) i1 = ceil(x1) nx = ceil((i1-i0)/dx) + 1 x = i0 + indgen(nx)*dx return, x end nx = ceil((x1-x0)/dx) + 1 x = x0 + findgen(nx)*dx return, x end