Geocentric lunar ephemeris library for OCaml.
Computes the Moon's ecliptic position and phase from a Unix timestamp.
No dependencies beyond the OCaml standard library.
Valid over 1900–2100, validated against JPL Horizons (DE441).
- OCaml ≥ 4.14
- dune ≥ 3.17
opam install msts
let e = Msts.compute (Unix.gettimeofday ()) in
Printf.printf "%s %.1f%% %.0f km\n"
(Msts.phase_name_to_string e.Msts.phase.Msts.name)
(e.Msts.phase.Msts.illuminated_fraction *. 100.0)
e.Msts.position.Msts.distance_kmAdd to your dune file:
(libraries msts)
See man 3 msts for the full API reference.
ISC