terrestrial_ellipsoidal

This module contains routines which more accurately represent positions on the earth than in terrestrial_spherical. Here the earth is modeled as an ellipsoid.

Primarily this module deals with expression of positions in geodetic coordinates.

Warning

The algorithms for dealing with positions on an ellipsoidal earth are less forgiving than for a spherical earth. Pay careful attention to details about inputs and outputs (e.g. units)

API

geospacepy.terrestrial_ellipsoidal.ecef_cart2geodetic(R_ECEF, tol=1e-07, maxiters=100)[source]

This implements Algorithm 12 (pp.179) of Fundamentals of Astrodynamics and Applications (3rd Edition) by David Vallado. The algorithm’s purpose is to transform the position vector of a spacecraft in earth-centered earth-fixed cartesian coordinates to geodetic latitude, geocentric longitude, and height above the surface of the earth.

Parameters:
  • R_ECEF (np.ndarray, shape=(n,3)) – n position vectors in cartesian ECEF, units must be meters
  • tol (float) – Tolerance for iterative determination of geodetic latitude, in radians. The algorithm stops when the change in geodetic latitude from one iteration to the next is less than the tolerance. Defaults to 1e-7, which is the value used in an example from the Vallado textbook (Example 3-3)
  • maxiters (int) – Maximum number of times the algorithm will attempt to refine the geodetic latitude before raising RuntimeError
Returns:

  • gdlats (np.ndarray, shape=(n,)) – Geodetic latitudes of each position in R_ECEF
  • gclons (np.ndarray, shape=(n,)) – Geocentric longitudes of each position in R_ECEF
  • h_ellps (np.ndarray, shape=(n,)) – Ellipsoidal height of each position in meters (the distance between each position and the ground, measured perpendicular to the surface of an ellipsoidal approximation of the earth)

Warns:

UserWarning – If ECEF positions are below earth’s surface (because it may be the position was in kilometers instead of meters)