question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Alpha-5 format export not behaving as I would naively expect ;)

See original GitHub issue

Short version, if Satellite.satnum is greater than 99999, TLEs with no object number are produced. Here’s a demonstration script; I was expecting that if satnum is an integer greater than 99999, the exporter would correctly encode it as alpha-5.

#!/usr/bin/env python3

from scipy.stats.contingency import expected_freq
from sgp4.io import twoline2rv
from sgp4 import exporter
from sgp4.earth_gravity import wgs72

# from https://celestrak.com/NORAD/elements/stations.txt
original_tle = (
    "1 25544U 98067A   21245.66660925  .00003909  00000-0  80185-4 0  9991",
    "2 25544  51.6444 319.5951 0003037 346.9445 145.3381 15.48588378300608",
)

# can I round-trip the TLE successfully?
iss_one = twoline2rv(original_tle[0], original_tle[1], wgs72)
iss_one_tle = exporter.export_tle(iss_one)
assert iss_one_tle == original_tle

# Unnecessary paranoia
iss_two = twoline2rv(iss_one_tle[0], iss_one_tle[1], wgs72)
assert iss_one.intldesg == iss_two.intldesg
assert iss_one.ecco == iss_two.ecco
assert iss_one.a == iss_two.a

# Can I increment the satnum?
bump_satnum = 12345
iss_two.satnum += bump_satnum
modified_tle = exporter.export_tle(iss_two)
modified_obj = twoline2rv(modified_tle[0], modified_tle[1], wgs72)
assert modified_obj.satnum - iss_one.satnum == bump_satnum

# Can I export this new alpha-5 format?
a5 = "A1234"
iss_two.satnum = a5
modified_tle = exporter.export_tle(iss_two)
assert a5 in modified_tle[0] and a5 in modified_tle[1]

# what happens if I try to load it
modified_obj = twoline2rv(modified_tle[0], modified_tle[1], wgs72)
final_tle = exporter.export_tle(modified_obj)
if iss_two.satnum != modified_obj.satnum:
    print(f"round trip fail: {modified_obj.satnum} != {iss_two.satnum}")
if modified_tle != final_tle:
    print(f"A5 test fail\n\texpected:{modified_tle}\n\tcomputed:{final_tle}")
$ python iss.py 
101234
round trip fail: 101234 != A1234
A5 test fail
	expected:('1 A1234U 98067A   21245.66660925  .00003909  00000-0  80185-4 0  9991', '2 A1234  51.6444 319.5951 0003037 346.9445 145.3381 15.48588378300608')
	computed:('1 U 98067A   21245.66660925  .00003909  00000-0  80185-4 0  9991', '2  51.6444 319.5951 0003037 346.9445 145.3381 15.48588378300608')

I’m using python-sgp4 2,20 on xubuntu 21.04 x86_64

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
brandon-rhodescommented, Sep 28, 2021

Not yet — given my schedule, it might not be til late October that I’m able to sit down for a code review? We’ll see!

1reaction
ckuethecommented, Sep 4, 2021

If you’re amenable to having a setter, then I’m amenable to doing up a PR.

I have use cases where I might want to change the satellite number, and use cases where I do have to construct a whole satellite record from orbital elements. In this case I was exploring Alpha-5 and adding 100000 to an otherwise valid TLE seemed like the fastest way to see what would happen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · brandon-rhodes/python-sgp4 - GitHub
Question: Support any other architecture but x86_64? ... Alpha-5 format export not behaving as I would naively expect ;) ... ProTip! Find all...
Read more >
Premiere Transparency Done Right! Tiny files with Alpha! No ...
With minimal effort: You can save time and drive space! Alpha mask videos in Premiere Pro are explained in this video, as well...
Read more >
Changelog — Python 3.11.1 documentation
gh-99729: Fix an issue that could cause frames to be visible to Python code as they are being torn down, possibly leading to...
Read more >
Package List — Spack 0.18.1 documentation
This is a list of things you can install using Spack. It is automatically generated based on the packages in this Spack version....
Read more >
scikit-learn user guide
1.2.8 How can I load my own datasets into a format usable by scikit-learn? ... There's a long-standing discussion about not being.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found