astra.utils module

astra.utils.vincenty_distance(lat1_deg, lon1_deg, lat2_deg, lon2_deg)[source]

Compute exact geodetic distance between two points on the WGS-84 ellipsoid.

Using Vincenty’s formulae. Accurate to within 0.5mm for non-antipodal points. Replaces Haversine spherical approx.

Warning

For points that are nearly antipodal (opposite poles of the ellipsoid), the Vincenty series may fail to converge (indeterminate form). In this case the function falls back to the Haversine great-circle approximation. In STRICT_MODE a ValueError is raised instead of silently degrading.

Parameters:
  • lat1_deg – WGS-84 geodetic coordinates of point A (degrees).

  • lon1_deg – WGS-84 geodetic coordinates of point A (degrees).

  • lat2_deg – WGS-84 geodetic coordinates of point B (degrees).

  • lon2_deg – WGS-84 geodetic coordinates of point B (degrees).

Returns:

Distance in kilometers.

Raises:

ValueError – In STRICT_MODE if the series fails to converge (antipodal pair).

astra.utils.orbital_elements(source, v=None)[source]

Extract Keplerian orbital elements from a TLE string or Cartesian state.

Parameters:
  • source – Either a raw TLE Line 2 string, a (3,) position vector [km], or an OrbitalState / NumericalState object.

  • v – Optional (3,) velocity vector [km/s] if source is a position vector.

Returns:

  • inclination_deg

  • raan_deg

  • eccentricity

  • arg_perigee_deg

  • mean_anomaly_deg (only for TLE)

  • true_anomaly_deg (only for Cartesian)

  • semimajor_axis_km

  • period_min

Return type:

Dictionary mapping element names to their values

astra.utils.orbit_period(mean_motion_rev_per_day)[source]

Compute the orbital period from mean motion.

Parameters:

mean_motion_rev_per_day – Mean motion in revolutions per day.

Returns:

Orbital period in minutes.