Orbis.Format.OMM (Orbis v0.9.1)

Copy Markdown View Source

Parse and encode CCSDS Orbit Mean-Elements Messages (OMM).

OMM is the modern standard format for orbital data, carrying the same elements as TLE but in structured JSON/XML. Used by CelesTrak and Space-Track.

Examples

{:ok, elements} = Orbis.Format.OMM.parse(json_map)
json_map = Orbis.Format.OMM.encode(elements)

Summary

Functions

Encode an %Orbis.Elements{} struct as an OMM JSON-compatible map.

Parse an OMM JSON map into an %Orbis.Elements{} struct.

Functions

encode(el)

@spec encode(Orbis.Elements.t()) :: map()

Encode an %Orbis.Elements{} struct as an OMM JSON-compatible map.

Returns a map with standard CCSDS OMM field names. Lossless for all f64 values.

parse(omm)

@spec parse(map()) :: {:ok, Orbis.Elements.t()} | {:error, String.t()}

Parse an OMM JSON map into an %Orbis.Elements{} struct.

Accepts maps with CelesTrak/Space-Track field names (e.g., "NORAD_CAT_ID", "INCLINATION", "MEAN_MOTION"). Handles both numeric and string values for numeric fields (Space-Track quirk).

Examples

iex> {:ok, el} = Orbis.Format.OMM.parse(%{
...>   "NORAD_CAT_ID" => 25544,
...>   "OBJECT_NAME" => "ISS (ZARYA)",
...>   "EPOCH" => "2024-01-01T00:00:00",
...>   "INCLINATION" => 51.6,
...>   "RA_OF_ASC_NODE" => 300.0,
...>   "ECCENTRICITY" => 0.0007,
...>   "ARG_OF_PERICENTER" => 90.0,
...>   "MEAN_ANOMALY" => 270.0,
...>   "MEAN_MOTION" => 15.5
...> })
iex> el.catalog_number
"25544"
iex> el.object_name
"ISS (ZARYA)"