Skip to main content

Module tle

Module tle 

Source
Expand description

Two-Line Element (TLE) format parser and encoder.

TLE is the legacy fixed-width format for satellite orbital elements, designed for 80-column punch cards. This module owns the complete format grammar: ASCII and fixed-width validation, the modulo-10 checksum, the “assumed decimal” exponent codec used for the drag terms, the per-field number formatting, and the two-digit-year pivot. It runs identically regardless of the calling language, so it lives in the core; the sidereon Elixir binding only marshals the epoch between its native DateTime and the (year, day_of_year) pair this module exposes, normalizes input defaults, and maps errors.

The epoch is represented here as a calendar year plus a one-based fractional day-of-year, exactly the two quantities the TLE epoch field encodes. This module owns the TLE two-digit-year pivot and converts that pair into SGP4’s split Julian date when building the format-agnostic element set.

Structs§

ChecksumWarning
A reported checksum discrepancy. The format grammar does not reject a line on a bad checksum (it is advisory), so this is surfaced for the host to log.
ParsedTle
The result of parse: the elements plus any advisory checksum warnings.
TleElements
Parsed TLE orbital elements in canonical astrodynamic units.

Enums§

TleError
Failure modes of parse. Messages mirror the historical reference strings.

Functions§

encode
Encode TleElements as the two 69-character TLE lines (with checksums).
parse
Parse a two-line element set into TleElements.