astra.frames module

astra.frames.get_eop_correction(times_jd)[source]

Fetch Spacebook Earth Orientation Parameters for a set of epochs. DEF-006: Batches calls by calendar day rather than per-timestep. For a 24-hour propagation at 5-minute steps (288 points), this reduces Spacebook API calls from 288 to ~1, with intra-day values taken from the representative midday fetch (EOP variation within a day is sub-ms). :returns: (xp_arcsec, yp_arcsec, dut1_s) arrays matching times_jd shape.

If Spacebook is disabled or offline, returns arrays of zeros.

astra.frames.teme_to_ecef(r_teme, times_jd, use_spacebook_eop=True)[source]

Convert TEME position vectors to ECEF (ITRS) coordinates. If use_spacebook_eop is True and Spacebook is enabled, precise COMSPOC EOP metrics are fetched and mathematically integrated into the GCRS-ITRS rotation differential. Otherwise, it natively uses Skyfield’s fallback IERS tables. :param r_teme: (N, 3) matrix of TEME Cartesian coordinates (km) :param times_jd: (N,) array of Julian Dates :param use_spacebook_eop: Boolean toggle to inject precise parameters.

Returns:

(N, 3) matrix of ECEF (ITRS) coordinates.

astra.frames.ecef_to_geodetic_wgs84(x, y, z)[source]

Convert ECEF Cartesian coordinates (km) to WGS84 Geodetic coordinates. Uses the Bowring (1976) single-pass iterative formula, which achieves ~0.1 mm accuracy at sea level and better at orbital altitudes. COORD-01 Fix: Handles the polar singularity (cos(lat)→0 at |lat|≥80°) by using the z-based altitude formula for high latitudes:

alt = |z|/sin(lat) - N*(1-e²)

instead of the equatorial formula (alt = p/cos(lat) - N) which produces infinite values when the satellite passes directly over a polar station. :param x: 1D arrays of cartesian coordinates in km. :param y: 1D arrays of cartesian coordinates in km. :param z: 1D arrays of cartesian coordinates in km.

Returns:

tuple of (latitude_deg, longitude_deg, altitude_km).

astra.frames.geodetic_to_ecef_wgs84(lat_deg, lon_deg, alt_km)[source]

Convert WGS84 Geodetic coordinates to ECEF Cartesian coordinates.

Inverse of ecef_to_geodetic_wgs84(). Converts latitude, longitude, and altitude to Earth-Centered Earth-Fixed (ECEF) Cartesian coordinates.

Uses the WGS84 ellipsoid parameters:

a = 6378.137 km (semi-major axis) f = 1/298.257223563 (flattening)

Parameters:
  • lat_deg – Latitude in degrees (WGS84), shape (N,).

  • lon_deg – Longitude in degrees (WGS84), shape (N,).

  • alt_km – Altitude above WGS84 ellipsoid in km, shape (N,).

Returns:

Tuple of (x_km, y_km, z_km) ECEF coordinates in km.

Reference:

Borkowski, K. M. (1989). “Accurate algorithms for transforming geocentric to geodetic coordinates”. Bulletin Géodésique.