- OCaml 100%
rdm #
CCSDS Re-entry Data Messages (CCSDS 508.1-B-1) for OCaml.
When a satellite or a rocket stage is about to fall back to Earth, the agencies
tracking it exchange predictions of when and where it will re-enter: the
remaining orbit lifetime, the re-entry epoch and its uncertainty, the impact
point and the expected casualty area. CCSDS 508.1-B-1 standardises that
exchange as the Re-entry Data Message (RDM), for controlled and uncontrolled
re-entries alike. rdm parses and prints its KVN (Keyword = Value Notation)
text form.
Installation #
Install with opam:
$ opam install rdm
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 rdm
Usage #
let report kvn_text =
match Rdm.of_string kvn_text with
| Error e -> Fmt.epr "%a@." Rdm.pp_error e
| Ok rdm -> (
Fmt.pr "Object: %s@." rdm.metadata.object_name;
Fmt.pr "Orbit lifetime: %.3f days@." rdm.reentry.orbit_lifetime;
Option.iter (Fmt.pr "Reentry epoch: %s@.") rdm.reentry.reentry_epoch;
match (rdm.reentry.impact_latitude, rdm.reentry.impact_longitude) with
| Some lat, Some lon -> Fmt.pr "Impact: %.3f N, %.3f E@." lat lon
| _ -> Fmt.pr "Impact location unknown@.")
Nothing is defaulted. A keyword CCSDS 508.1-B-1 makes mandatory is an error
when it is missing, so of_string "" is Error (Missing_keyword "CCSDS_RDM_VERS"), and a value that does not parse is reported with the line
it was read on. of_channel and of_file read the same text from a channel
and a file, and to_string writes a message back as KVN.
Licence #
ISC. See LICENSE.md.