brandon-rhodes / python-sgp4

Python version of the SGP4 satellite position library
MIT License
376 stars 88 forks source link

Parse TLE without checksum #121

Closed trufanov-nok closed 10 months ago

trufanov-nok commented 1 year ago

https://github.com/brandon-rhodes/python-sgp4/blob/fac882aed0e8e5eb2cbd17409e00c7feb7c577ea/sgp4/io.py#L169

Very old c++ sources that supplement this article https://celestrak.org/publications/AIAA/2008-6770/ contain TWOLINES.TXT dataset of TLE records. Some of them are 1 char shorter - they lack 1 char checksum value at the end. In this case the code I referred to can't read line 2 as len(line) >= 69 fails. If it would be >= 68 the TLE read successfully. Sample TLEs from vallado's article:

#COURIER 1B
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
#INTELSAT 1-F1
1 01317U 65028A   96319.00000000 -.00000073  00000-0 +10000-3 0 0497
2 01317  14.3842 342.1674 0001104 344.6118 333.1881  1.0036445301882

May be it will be better to replace 69 with 68?

brandon-rhodes commented 10 months ago

Thanks for reporting this! I have adjusted the Python code so that it now better matches the C++ code. This should be fixed at the next release.