choclo.utils.distance_spherical
choclo.utils.distance_spherical#
- choclo.utils.distance_spherical(longitude_p, latitude_p, radius_p, longitude_q, latitude_q, radius_q)[source]#
Euclidean distance between two points in spherical coordinates
Important
All angles must be in degrees and radii in meters.
- Parameters
longitude_p (float) – Longitude coordinate of point \(\mathbf{p}\) in degrees.
latitude_p (float) – Latitude coordinate of point \(\mathbf{p}\) in degrees.
radius_p (float) – Radial coordinate of point \(\mathbf{p}\) in meters.
longitude_q (float) – Longitude coordinate of point \(\mathbf{q}\) in degrees.
latitude_q (float) – Latitude coordinate of point \(\mathbf{q}\) in degrees.
radius_q (float) – Radial coordinate of point \(\mathbf{q}\) in meters.
- Returns
distance (float) – Euclidean distance between
point_p
andpoint_q
.
Notes
Given two points \(\mathbf{p} = (\lambda_p, \phi_p, r_p)\) and \(\mathbf{q} = (\lambda_q, \phi_q, r_q)\) defined in a spherical coordinate system \((\lambda, \phi, r)\), return the Euclidean (L2) distance between them:
\[d = \sqrt{ (r_p - r_q) ^ 2 + 2 r_p r_q (1 - \cos\psi)}\]where
\[\cos\psi = \sin\phi_p \sin\phi_q + \cos\phi_p \cos\phi_q \cos(\lambda_p - \lambda_q)\]and \(\lambda\) is the longitude angle, \(\phi\) the spherical latitude angle an \(r\) is the radial coordinate.