-
-
Notifications
You must be signed in to change notification settings - Fork 93
fix missing revnum attribute on pure-python Satrec #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
brandon-rhodes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting together this fix, complete with a test! It looks like a couple of tests are failing in CI, but I'll be happy to merge this once you get them fixed. Thanks!
sgp4/model.py
Outdated
|
|
||
| self.jdsatepoch = whole_jd | ||
| self.jdsatepochF = fraction | ||
| self.revnum = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move this down to just beneath self.classification? That's what it sits next to over in the C++ code, and would make it a bit easier for my eyes to find it later than up here with the dates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think setting this to 0 here was a flawed approach, which I didn't see until I saw the failing CI tests. To make the patch less invasive, I adjusted my approach just to fix the error when exporting a TLE from a pure python Satrec initialized with sgp4init, as I'm not aware of anything else that needs it.
sgp4/tests.py
Outdated
| outline1, outline2 = export_tle(sat) | ||
| parsed_sat = Satrec.twoline2rv(outline1, outline2, WGS84) | ||
| for attr in VANGUARD_ATTRS.keys(): | ||
| assertEqual(getattr(parsed_sat, attr), getattr(sat, attr)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how you didn't just make sure that export_tle() worked, but that the same satellite came back when re-parsed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Updated to use assert_satellites_match which I hadn't noticed before.
436de5e to
8ee25ed
Compare
|
Sorry for the spam with the broken tests. I couldn't replicate locally for some reason, will figure out in the next day or two. |
|
Finally came back to this, saw what I did wrong in the tests, and fixed and expanded them. Hopefully it's all good this time! |
This missing attribute was preventing such satellites from exporting. (This supersedes pull request #134, which tried instead to harden the export routine against the possibly-missing attribute.)
|
I have finally had time to circle back to this, and in case anyone else's code ever looks for Also, I have written a |
|
Looks great, thanks Brandon! |
|
I'm hoping to find time next week for a release, to get this feature out. Thanks again for pointing out the problem. |
Failure looks like this:
Let me know if any adjustments are needed.