watex.utils.get_distance#
- watex.utils.get_distance(x, y, *, return_mean_dist=False, is_latlon=False, **kws)[source]#
Compute distance between points
- Parameters:
x (ArrayLike 1d,) – One dimensional arrays. x can be consider as the abscissa of the landmark and y as ordinates array.
y (ArrayLike 1d,) – One dimensional arrays. x can be consider as the abscissa of the landmark and y as ordinates array.
return_mean_dist (bool, default =False,) – Returns the average value of the distance between different points.
is_latlon (bool, default=False,) – Convert x and y latitude and longitude coordinates values into UTM before computing the distance. x, y should be considered as
eastingandnorthingrespectively.kws (dict,) – Keyword arguments passed to
watex.site.Location.to_utm_in()
- Returns:
d – Is the distance between points.
- Return type:
Arraylike of shape (N-1)
Examples
>>> import numpy as np >>> from watex.utils.exmath import get_distance >>> x = np.random.rand (7) *10 >>> y = np.abs ( np.random.randn (7) * 12 ) >>> get_distance (x, y) array([ 8.7665511 , 12.47545656, 8.53730212, 13.54998351, 14.0419387 , 20.12086781]) >>> get_distance (x, y, return_mean_dist= True) 12.91534996818084