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#
Install with opam:
$ opam install coordinate
If opam cannot find the package, it may not yet be released in the public
opam-repository. Add the overlay repository, then install it:
$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install coordinate
Usage#
(* Convert SGP4 TEME output to geodetic coordinates. *)
let report_position ~unix_time (teme_pos : Vec3.t) =
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
Fmt.pr "Lat: %.4f Lon: %.4f Alt: %.1f km@."
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 constantsgmst_of_unix,gmst-- Greenwich Mean Sidereal Time (IAU 1982)teme_to_ecef,ecef_to_teme-- TEME/ECEF rotation via GMSTj2000_to_ecef,ecef_to_j2000-- J2000/ECEF rotationecef_to_geodetic-- Bowring's iterative method on WGS-84 ellipsoidgeodetic_to_ecef-- Geodetic to ECEFteme_to_geodetic-- TEME to geodetic (convenience)
License#
ISC