Skip to content

Commit

Permalink
Fix #121: Python should not require checksum char
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-rhodes committed Dec 18, 2023
1 parent 0f5546d commit f527737
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions sgp4/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,11 @@
Changelog
---------
Unreleased — 2.24
* Tweaked the fallback Python code to accept TLE lines without a final
checksum character in the 69th column, to match the C++ code.
2023-10-01 — 2.23
* Tweaked tests to resolve breakage introduced by Python 3.12.
Expand Down
2 changes: 1 addition & 1 deletion sgp4/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def twoline2rv(longstr1, longstr2, whichconst, opsmode='i', satrec=None):

line = longstr2.rstrip()

if (len(line) >= 69 and
if (len(line) >= 68 and
line.startswith('2 ') and
line[7] == ' ' and
line[11] == '.' and
Expand Down
6 changes: 6 additions & 0 deletions sgp4/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,12 @@ def test_1990s_satrec_initialized_with_sgp4init():
)
assertEqual(sat.epochyr, 99)

def test_tle_that_lacks_checksums():
Satrec.twoline2rv(
'1 00058U 60013A 97142.85906518 .00000093 00000-0 +10762-4 0 274',
'2 00058 028.3286 356.4726 0164991 158.6392 202.1128 13.4602145880282',
)

def test_setters():
sat = Satrec()

Expand Down

0 comments on commit f527737

Please sign in to comment.