terrestrial_spherical

This module contains various routines for manipulating vectors related to positions and observations on and around the earth under the approximation that the earth is a sphere

The spherical assumption implies the following:
  • All latitudes are geo*centric* not geo*detic*
  • All altitudes are measured relative to the center of the earth, not perpendicular to the earth’s surface

Note

All of the coordinate transformations in this module work both for position vectors and for other vectors, such as vector measurements. A corrolary of this is these routines aren’t picky about units.

Converting Multiple Vectors

If an input is described as a vector, it is expected to be a numpy array with the vector components as columns.

For example:

  • One vector would be an array of shape ( 1 , 3 )
  • n vectors would be an array of shape ( n , 3 )

Other inputs (not described as vectors) are broadcast to match the shape of the vector input(s), if possible.

API

geospacepy.terrestrial_spherical.ecef2eci(R_ECEF, jds)[source]

Rotate a vector from cartesian Earth Centered Earth Fixed (ECEF) to Cartesian Earth Centered Inertial (ECI)

Parameters:
  • R_ECEF (np.ndarray) – Array of n three component vectors ( shape=(n,3) ) in ECEF
  • jds (float or np.ndarray) – Time stamp (as julian date) for all (if float) or each (if array) of the vectors in R_ECEF
Returns:

R_ECI – n three component vectors ( shape=(n,3) ) in ECI

Return type:

np.ndarray

geospacepy.terrestrial_spherical.ecef2enu(R_ECEF, lats, lons)[source]

Rotate n vectors from Earth Centered Earth Fixed (ECEF) to local east, north, up coordinates centered at one location if only a single lat/lon pair is passed, or n locations if lats and lons are arrays of length n

Parameters:
  • R_ECEF (np.ndarray) – Array of n 3-component vectors (shape=(n,3)) in cartesian ECEF
  • lats (float or np.ndarray) – Latitude(s) of ENU coordinates
  • lons (float or np.ndarray) – Longitude(s) of ENU coordinates
Returns:

R_ENU – Array of n 3-component vecotrs (shape=(n,3)) in cartesian ENU (R_ENU[:,0] is eastward component, R_ENU[:,1] is northward, etc.)

Return type:

np.ndarray

geospacepy.terrestrial_spherical.ecef_cart2spherical(R_ECEF)[source]

Transform a vector in cartesian Earth Centered Earth Fixed (ECEF) to geocentric spherical (a.k.a geographic coordinates)

Parameters:R_ECEF (np.ndarray) – Array of n three component vectors ( shape=(n,3) ) in cartesian ECEF
Returns:
  • lats (np.ndarray) – Array of n latitude values (shape=(n,))
  • lons (np.ndarray) – Array of n longitude values (shape=(n,)). Sign convention is ISO 6709 (west is negative)
  • rs (np.ndarray) – Array of n radii (distance from center of the earth) (shape=(n,)) (same units as R_ECEF)
geospacepy.terrestrial_spherical.ecef_spherical2cart(lats, lons, rs)[source]

Transform n positions in geocentric spherical, a.k.a. spherical Earth Centered Earth Fixed (ECEF), a.k.a geographic to cartesian Earth Centered Earth Fixed (ECEF)

Parameters:
  • lats (float or np.ndarray) – Array of n latitude values (shape=(n,))
  • lons (float or np.ndarray) – Array of n longitude values (shape=(n,)). Sign convention is ISO 6709 (west is negative)
  • rs (float or np.ndarray) – Array of n radii (distance from center of the earth) (shape=(n,))
Returns:

  • R_ECEF (np.ndarray) – Array of n three component vectors ( shape=(n,3) ) in cartesian ECEF
  • .. note:: – Within the code the ISO 31-11 convention for theta (polar, zero at positive z axis), and phi (azimuthal, zero at positive x axis) is used

geospacepy.terrestrial_spherical.eci2ecef(R_ECI, jds)[source]

Rotate a vector from cartesian Earth Centered Inertial (ECI) to cartesian Earth Centered Earth Fixed (ECEF)

Parameters:
  • R_ECI (np.ndarray) – Array of n three component vectors ( shape=(n,3) ) in ECI
  • jds (float or np.ndarray) – Time stamp (as julian date) for all (if float) or each (if array) of the vectors in R_ECEF
Returns:

R_ECEF – n three component vectors ( shape=(n,3) ) in ECEF

Return type:

np.ndarray

geospacepy.terrestrial_spherical.enu2ecef(R_ENU, lats, lons)[source]

Rotate n vectors from East North Up (ENU) (relative to location(s) specified by lats and lons) to Earth Centered Earth Fixed (ECEF) coordinates

Parameters:
  • R_ENU (np.ndarray) – Array of n 3-component vectors (shape=(n,3)) in cartesian ENU
  • lats (float or np.ndarray) – Latitude(s) which define ENU directions
  • lons (float or np.ndarray) – Longitude(s) which define ENU direction
Returns:

R_ECEF – Array of n 3-component vectors (shape=(n,3)) in cartesian ECEF

Return type:

np.ndarray