lair.transects.along_route_distance#
- lair.transects.along_route_distance(lon, lat)[source]#
Cumulative geodesic distance along the ordered route points.
- Parameters:
lon (np.ndarray) – Longitude and latitude of the route points, in order along the route.
lat (np.ndarray) – Longitude and latitude of the route points, in order along the route.
- Returns:
np.ndarray – Distance from the first point on the WGS84 ellipsoid (km), starting at 0.
- Return type:
See also
lair.geo.haversineThe distance between two points on a sphere.
Notes
Needs the
geoextra (pyproj).Examples
Three points 0.01 degrees of latitude apart, about 1.11 km:
>>> import numpy as np >>> from lair.transects import along_route_distance >>> lon = np.array([-111.9, -111.9, -111.9]) >>> lat = np.array([40.70, 40.71, 40.72]) >>> along_route_distance(lon, lat).round(2) array([0. , 1.11, 2.22])