module

Kozai::OMM

Reading orbital elements from CCSDS Orbit Mean-Elements Messages.

OMM is the modern replacement for the two-line element set, and CelesTrak serves it alongside the classic format. It carries the same numbers without the fixed-column packing, so nothing is lost to a five-digit field: catalog numbers beyond the alpha-5 range and full-precision drag terms both survive.

The JSON encoding is used rather than XML or KVN because the standard library parses JSON in Crystal itself, with no C library behind it. That is the whole reason this module exists in this form.

elements = Kozai::OMM.parse(File.read("amateur.json"))
satellites = elements.map { |e| Kozai::SGP4::Satellite.new(e) }

Class methods

from_json(message : JSON::Any, index : Int32 = 0) : TLE::Elements

Builds an element set from a single OMM message.

Source
parse(text : String) : Array(TLE::Elements)

Parses an OMM document.

Accepts either a single message object or an array of them, which is what CelesTrak returns for a group query.

Raises OMM::ParseError if the document is not valid JSON or a message is missing a mandatory element.

Source
parse_epoch(text : String, index : Int32 = 0) : Tuple(Int32, Float64)

Splits an OMM epoch into a four-digit year and a day of year.

NOTE: parsed by hand rather than with a date library. OMM epochs come in as 2026-08-03T19:06:47.841984, usually with no timezone marker; the standard says UTC, and this library has no other timescale anyway. Doing it here also keeps the full fractional second, which matters because the epoch is the origin every propagation is measured from.

Source
parse_file(path : String) : Array(TLE::Elements)

Reads and parses an OMM file.

Source

Nested types