adding support for the OMM format (JSON/XML/KVN/CSV) - #26
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for the CCSDS OMM (Orbit Mean-Elements Message, 502.0-B-3), the format Space-Track
distributes alongside the TLEs. The TLE support is untouched: this is purely additive for the user.
New
dsgp4.ommmodule:auto-detection from content and file extension:
omm.load,omm.loads,omm.dumps,omm.parse_json/parse_xml/parse_kvn/parse_csv;dsgp4.omm.OMMobjects can be built from a dictionary of OMM fields (e.g. what the Space-TrackAPI returns), from a string containing a single message, or from the usual dictionary of elements;
TLE.to_omm()andOMM.to_tle()convert between the two formats.OMMsubclassesdsgp4.tle.TLEand fills the very same_datadictionary, so an OMM can be usedeverywhere a TLE is expected without touching a single line of the propagator:
initialize_tle,propagate,propagate_batch,newton_method,plot_tlesandmldsgp4all work as they are(there are tests for this). What an OMM does not inherit is the two fixed-width lines: objects
whose catalog number is above 339999 cannot be encoded even with Alpha-5, so they only exist as
OMMs, and
to_tle()raises theValueErrorthat #25 already pointed at.Three small things also had to change in the TLE side, all needed to let the OMM subclass reuse the machinery:
verbatim in
load_from_linesandload_from_data: it is nowtle.add_derived_quantities,which the OMM loader uses too (behaviour is identical, the TLE tests are untouched);
copy,set_timeandupdatenow build an object oftype(self)instead of hard-codingTLE, so they round-trip for the classes that inherit from it (same reason for the twotype(...)innewton_method);TLE.__getattr__raises a properAttributeErrorfor unknown attributes, instead of theconfusing
'super' object has no attribute '__getattr__'it raised before.Tests wise:
_bstar,_ndot,_nddot,_ecco,_argpo,_inclo,_mo,_no_kozai,_nodeo,_jdsatepoch,_jdsatepochF, andtherefore identical states.
python-sgp4: the elements are exactly equal, and thestates agree to ~5e-5 mm once the gravity model matches (their
omm.initializeseems to use WGS-72).tests/test_omm.py, covering the four formats, theTLE/OMM conversions, files, the >339999 catalog numbers, the optional and empty fields, and the
error paths. The whole suite is 58 passing tests.
New
doc/notebooks/omm_object.ipynbtutorial (withexample_omm.json), a quick-start section inthe README, and the new entries in
api.rst,tutorials.rstandcapabilities.ipynb.Other notes:
SEMIMAJOR_AXIS,DECAY_DATE,TLE_LINE1) are kept inomm._fieldsas they were read, but they are not regenerated when thefields are rebuilt from the elements (i.e. after
copy,set_timeorupdate).SGP4-likeMEAN_ELEMENT_THEORYvalues are accepted, since dSGP4 cannot propagate (for now :)) e.g. SGP4-XP elements.