verde.profile_coordinates¶

verde.profile_coordinates(point1, point2, size, extra_coords=None)[source]

Coordinates for a profile along a straight line between two points.

Parameters: point1 : tuple or list (easting, northing) West-East and South-North coordinates of the first point, respectively. point2 : tuple or list (easting, northing) West-East and South-North coordinates of the second point, respectively. size : int Number of points to sample along the line. extra_coords : None, scalar, or list If not None, then value(s) of extra coordinate arrays to be generated. These extra arrays will have the same size as the others but will contain a constant value. Will generate an extra array per value given in extra_coords. Use this to generate arrays of constant heights or times, for example, that might be needed to evaluate a gridder. coordinates, distances : tuple and 1d array The coordinates of points along the straight line and the distances from the first point.

See also

scatter_points
Generate the coordinates for a random scatter of points
grid_coordinates
Generate coordinates for each point on a regular grid

Examples

>>> (east, north), dist = profile_coordinates((1, 10), (1, 20), size=11)
>>> print('easting:', ', '.join('{:.1f}'.format(i) for i in east))
easting: 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
>>> print('northing:', ', '.join('{:.1f}'.format(i) for i in north))
northing: 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0
>>> print('distance:', ', '.join('{:.1f}'.format(i) for i in dist))
distance: 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0
>>> (east, north, height), dist = profile_coordinates(
...     (1, 10), (1, 20), size=11, extra_coords=35)
>>> print(height)
[35. 35. 35. 35. 35. 35. 35. 35. 35. 35. 35.]
>>> (east, north, height, time), dist = profile_coordinates(
...     (1, 10), (1, 20), size=11, extra_coords=[35, 0.1])
>>> print(height)
[35. 35. 35. 35. 35. 35. 35. 35. 35. 35. 35.]
>>> print(time)
[0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1]