Skip to content

redplanet.helper_functions.geodesy.get_distance

get_distance(
    start: list | numpy.ndarray, end: list | numpy.ndarray
) -> ndarray

Calculate the geodesic distance between two points on the surface of Mars.

Parameters:

Name Type Description Default
start list | np.ndarray

Array of shape (2) or (n_points, 2) containing the longitude and latitude coordinates of the starting point(s).

required
end list | np.ndarray

Similar to start, but for the ending point(s).

required

Returns:

Type Description
np.ndarray

Array of shape (n_points) [? verify this] containing the geodesic distances between the corresponding starting and ending point(s).

See Also

cartopy.geodesic.Geodesic.circle

Notes

Details on the Mars reference ellipsoid (oblate ellipsoid) used for these calculations:

  • Parameters:
    • Semimajor axis : 3395428 m
    • Flattening : 0.005227617843759314
    • GM : 42828372000000.0 m³/s²
    • Angular velocity : 7.0882181e-05 rad/s
  • Sources:
    • Main:
      • Ardalan, A. A., Karimi, R., & Grafarend, E. W. (2009). A New Reference Equipotential Surface, and Reference Ellipsoid for the Planet Mars. Earth, Moon, and Planets, 106, 1-13.
      • https://doi.org/10.1007/s11038-009-9342-7
    • (Found it here:)
      • https://www.fatiando.org/boule/latest/ellipsoids.html

For geodesic calculations, we use cartopy.geodesic.Geodesic.circle.

Source code in src/redplanet/helper_functions/geodesy.py
def get_distance(
    start : list | np.ndarray,
    end   : list | np.ndarray,
) -> np.ndarray:
    """
    Calculate the geodesic distance between two points on the surface of Mars.

    Parameters
    ----------
    start : list | np.ndarray
        Array of shape (2) or (n_points, 2) containing the longitude and latitude coordinates of the starting point(s).
    end : list | np.ndarray
        Similar to `start`, but for the ending point(s).

    Returns
    -------
    np.ndarray
        Array of shape (n_points) [? verify this] containing the geodesic distances between the corresponding starting and ending point(s).

    See Also
    --------
    [cartopy.geodesic.Geodesic.circle](https://scitools.org.uk/cartopy/docs/latest/reference/generated/cartopy.geodesic.Geodesic.html)

    Notes
    -----
    Details on the Mars reference ellipsoid (oblate ellipsoid) used for these calculations:

    - Parameters:
        - Semimajor axis   : 3395428 m
        - Flattening       : 0.005227617843759314
        - GM               : 42828372000000.0 m³/s²
        - Angular velocity : 7.0882181e-05 rad/s
    - Sources:
        - Main:
            - Ardalan, A. A., Karimi, R., & Grafarend, E. W. (2009). A New Reference Equipotential Surface, and Reference Ellipsoid for the Planet Mars. Earth, Moon, and Planets, 106, 1-13.
            - https://doi.org/10.1007/s11038-009-9342-7
        - (Found it here:)
            - https://www.fatiando.org/boule/latest/ellipsoids.html

    For geodesic calculations, we use [cartopy.geodesic.Geodesic.circle](https://scitools.org.uk/cartopy/docs/latest/reference/generated/cartopy.geodesic.Geodesic.html).
    """
    geodesic = __get_mars_geodesic()
    return geodesic.inverse(start, end)