verde.scatter_points

verde.scatter_points(region, size, random_state=None)[source]

Generate the coordinates for a random scatter of points.

The points are drawn from a uniform distribution.

Parameters:
region : list = [W, E, S, N]

The boundaries of a given region in Cartesian or geographic coordinates.

size : int

The number of points to generate.

random_state : numpy.random.RandomState or an int seed

A random number generator used to define the state of the random permutations. Use a fixed seed to make sure computations are reproducible. Use None to choose a seed automatically (resulting in different numbers with each run).

Returns:
easting, northing : 1d arrays

The West-East and South-North coordinates of each point.

See also

grid_coordinates
Generate coordinates for each point on a regular grid
profile_coordinates
Coordinates for a profile between two points

Examples

>>> # We'll use a seed value will ensure that the same will be generated
>>> # every time.
>>> easting, northing = scatter_points((0, 10, -2, -1), 4, random_state=0)
>>> print(', '.join(['{:.4f}'.format(i) for i in easting]))
5.4881, 7.1519, 6.0276, 5.4488
>>> print(', '.join(['{:.4f}'.format(i) for i in northing]))
-1.5763, -1.3541, -1.5624, -1.1082