astra.tle module

ASTRA Core TLE parsing and validation.

This module is the entry point for all data entering ASTRA Core. It handles parsing, validation, and batch loading of Two-Line Element (TLE) sets from raw text.

astra.tle.check_tle_staleness(satellite, target_jd)[source]

Verify that the propagation time is within 30 days of the satellite epoch.

SGP4 accuracy degrades exponentially over time. For mission-critical analysis, using TLEs older than 30 days is discouraged and blocked in STRICT mode.

Parameters:
  • satellite – The SatelliteTLE or SatelliteOMM object being propagated.

  • target_jd – The target Julian Date(s) for propagation.

Raises:

PropagationError – If delta > 30 days and ASTRA_STRICT_MODE is True.

astra.tle.parse_tle(name, line1, line2)[source]

Parse three raw TLE lines into a validated SatelliteTLE object.

Parameters:
  • name – Object name string.

  • line1 – TLE line 1.

  • line2 – TLE line 2.

Returns:

A fully populated SatelliteTLE instance.

Raises:

InvalidTLEError – If any validation fails.

astra.tle.validate_tle(name, line1, line2)[source]

Non-destructive validation of TLE strings.

Parameters:
  • name – Object name string.

  • line1 – TLE line 1.

  • line2 – TLE line 2.

Returns:

True if TLE is well-formed and checksums pass, False otherwise.

astra.tle.load_tle_catalog(tle_lines)[source]

Parse a batch of TLE text lines into SatelliteTLE objects.

Invalid TLEs are skipped with a logged warning, unless ASTRA_STRICT_MODE is enabled. In STRICT mode, a single invalid TLE will raise an InvalidTLEError and abort the entire catalog load to prevent partial ingestion.

Parameters:

tle_lines – A flat list of strings, typically expected to be in triplets: name, line1, line2.

Returns:

List of successfully parsed SatelliteTLE objects.

Raises:

AstraError – If total parse failure occurs (result is empty but input was non-empty).