PyNGL Home > Functions > Array creators

Ngl.fspan

Creates an array of evenly-spaced floating point numbers.

Prototype

sarray = Ngl.fspan(start, end, num)

Arguments

start

Value at which to start.

end

Value at which to end.

num

Number of equally-spaced points desired between start and end.

Return value

sarray

A one-dimensional floating point NumPy array of length num.

Description

This function returns an array of equally spaced floating point numbers in the range that starts at the value of the first argument and ends at the value of the second argument. The third argument specifies the number of points desired, including the start and end values.

Examples

import Ngl

x1 = Ngl.fspan(-1,1,5)        # [ -1. -0.5  0.0  0.5  1. ]
x2 = Ngl.fspan(0.,100.,6)     # [ 0.   20.   40.   60.   80.  100.]