Creates an array of evenly-spaced floating point numbers.
function fspan ( start  : numeric, finish  : numeric, npts  : integral type ) return_val [npts] : float
Value at which to start.finish
Value at which to end.npts
Number of equally-spaced points desired between start and finish. This value must be >= 2.
See note below about a bug if npts=1.
In version 6.0.0, this function will be upgraded to allow npts to be of any signed integral type (byte, short, int, long, int64).
fspan returns a 1D array with npts equally-spaced points from start to finish, inclusive.
Bug note: In NCL V6.2.0 and earlier, if you set npts = 1, you will get back a value of zero and no warning or error. This is considered a bug, and in V6.2.1 this will produce an appropriate error.
The integers 0 and 100 will be coerced to the type float, as required by the fspan function.
x = fspan(0, 100, 11) ; x = (/0., 10., ... , 90., 100./) (11 values) mlon = 128 dlon = 360. / mlon lon = fspan (0, (mlon - 1) * dlon, mlon) ; lon = (/0, 2.8125, ... , 357.1875/)
You can swap the first two arguments to get a descending array:
mlon = 128 dlon = 360. / mlon lon = fspan ((mlon - 1) * dlon, 0, mlon) ; lon = (/357.1875, 354.375,...0/)
With version 6.0.0 or later, you can input an npts that is greater than or equal to 2 gigabytes (GB), if you are on a 64-bit system:
npts = tolong(2^32) x = fspan (start, finish, npts) ; array with 2^32 elements
To get an array of, say, 50 numbers all equal to the same value, say, 0.2, you can use this trick:
N = 50 x = fspan (0.2,0.2,N)