stemflow.utils.sphere.distance
distance_from_3D_point(x1, y1, z1, x2, y2, z2, radius=6371.0)
Calculate the distance (km) between two 3D points
Parameters:
-
x1
(float
) –x1
-
y1
(float
) –y1
-
z1
(float
) –z1
-
x2
(float
) –x2
-
y2
(float
) –y2
-
z2
(float
) –z2
-
radius
(float
, default:6371.0
) –radius of earth. Defaults to 6371.0.
Returns:
-
float
(float
) –distance in km.
Source code in stemflow/utils/sphere/distance.py
haversine_distance(coord1, coord2, radius_earth=6371.0)
Calculate the Haversine distance between two sets of coordinates.
Parameters:
-
coord1
(tuple
) –(latitude, longitude) for the first point
-
coord2
(tuple
) –(latitude, longitude) for the second point
Returns:
-
float
–Haversine distance in kilometers
Source code in stemflow/utils/sphere/distance.py
spherical_distance_from_coordinates(inclination1, azimuth1, inclination2, azimuth2, radius=6371.0)
Calculate the spherical distance between two points on a sphere given their spherical coordinates.
Parameters:
-
radius
(float
, default:6371.0
) –Radius of the sphere.
-
inclination1
(float
) –Inclination angle of the first point in Radius.
-
azimuth1
(float
) –Azimuth angle of the first point in Radius.
-
inclination2
(float
) –Inclination angle of the second point in Radius.
-
azimuth2
(float
) –Azimuth angle of the second point in Radius.
Returns:
-
float
–Spherical distance between the two points in the same units as the sphere's radius.