Astrodynamics coordinate frame transforms
OCaml 92.7%
Dune 1.7%
Other 5.6%
13 1 0

Clone this repository

https://tangled.org/gazagnaire.org/ocaml-coordinate https://tangled.org/did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-coordinate
git@git.recoil.org:gazagnaire.org/ocaml-coordinate git@git.recoil.org:did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-coordinate

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

coordinate#

Astrodynamics coordinate frame transforms.

Conversions between standard reference frames used in satellite operations: TEME (SGP4 output), ECEF (Earth-fixed), J2000/EME2000 (inertial), and geodetic (lat/lon/alt). Includes WGS-84 constants and GMST computation.

Installation#

opam install coordinate

Usage#

(* Convert SGP4 TEME output to geodetic coordinates *)
let gmst = Coordinate.gmst_of_unix unix_time in
let ecef = Coordinate.teme_to_ecef ~gmst teme_pos in
let geo = Coordinate.ecef_to_geodetic ecef in
Printf.printf "Lat: %.4f  Lon: %.4f  Alt: %.1f km\n" geo.lat geo.lon geo.alt

API Overview#

  • type vec3 -- Cartesian position/velocity vector (km or km/s)
  • type geodetic -- lat (deg), lon (deg), alt (km)
  • earth_radius, earth_mu, earth_j2 -- WGS-84 constants
  • gmst_of_unix, gmst -- Greenwich Mean Sidereal Time (IAU 1982)
  • teme_to_ecef, ecef_to_teme -- TEME/ECEF rotation via GMST
  • j2000_to_ecef, ecef_to_j2000 -- J2000/ECEF rotation
  • ecef_to_geodetic -- Bowring's iterative method on WGS-84 ellipsoid
  • geodetic_to_ecef -- Geodetic to ECEF
  • teme_to_geodetic -- TEME to geodetic (convenience)

License#

ISC