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_pfloat

Longitude coordinate of point \(\mathbf{p}\) in degrees.

latitude_pfloat

Latitude coordinate of point \(\mathbf{p}\) in degrees.

radius_pfloat

Radial coordinate of point \(\mathbf{p}\) in meters.

longitude_qfloat

Longitude coordinate of point \(\mathbf{q}\) in degrees.

latitude_qfloat

Latitude coordinate of point \(\mathbf{q}\) in degrees.

radius_qfloat

Radial coordinate of point \(\mathbf{q}\) in meters.

Returns:
distancefloat

Euclidean distance between point_p and point_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.