Skip to content

sgp4: reject SGP4-XP element sets (ephemeris type 4) with a clear error - #174

Open
ssmichael1 wants to merge 1 commit into
mainfrom
tle-reject-type4
Open

sgp4: reject SGP4-XP element sets (ephemeris type 4) with a clear error#174
ssmichael1 wants to merge 1 commit into
mainfrom
tle-reject-type4

Conversation

@ssmichael1

Copy link
Copy Markdown
Owner

Summary

sgp4() now refuses SGP4-XP element sets instead of silently propagating them, for TLE and OMM inputs, in Rust and Python.

An SGP4-XP line 1 (ephemeris type 4, column 63) stores agom and a B term in the columns a classic TLE uses for nddot and B*. satkit parsed those as nddot/bstar and ran classic SGP4 on them, returning a plausible but wrong state.

Changes

  • TLE: new tle::Error::UnsupportedEphemerisType(u8); the SGP4Source impl returns it for type 4. Parsing is unchanged, so catalog files mixing types still load.
  • OMM: same guard on EPHEMERIS_TYPE == 4 with a matching omm::Error::UnsupportedEphemerisType.
  • Python dict path: omm_from_pydict never copied EPHEMERIS_TYPE, so the Rust guard could not see it. It now carries the field through (top level and nested tleParameters, int or numeric string). Python raises RuntimeError mentioning SGP4-XP.
  • Docs: field doc on ephem_type (Rust + stub), a paragraph in the SGP4 guide, changelog line.

Not in scope: any SGP4-XP support. The reference implementation is distributed by USSF as Fortran binaries only; examined and dropped.

Tests

  • Rust: one test per source using a line from the Astro Standards sample XP catalog with a checksum appended (the vendor's own 68-char lines already failed the length check; checksummed lines were the silent case). Full lib suite: 298 passed. Clippy clean.
  • Python: two tests in test_sgp4.py. Full suite minus GMAT: 169 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QpWfy5Nh7LVU531hD5Lkwv

An SGP4-XP line 1 stores agom and a B term in the columns a classic TLE
uses for nddot and B*. satkit parsed those as nddot/bstar and ran classic
SGP4 on them, returning a plausible but wrong state. The TLE and OMM SGP4
sources now return an UnsupportedEphemerisType error for type 4; parsing
is unchanged so mixed catalogs still load.

The Python dict-to-OMM converter never copied EPHEMERIS_TYPE, so the guard
could not see it from that path; it now carries the field through (top
level and tleParameters, int or numeric string).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QpWfy5Nh7LVU531hD5Lkwv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant