def load_gp_from_celestrak(*, catalog_number=None, international_designator=None, name=None): """Load general perturbations orbital data from Celestrak. Returns ------- Satrec Orbital data from specified object. Notes ----- This uses the OMM XML format from Celestrak as described in [1]_. References ---------- .. [1] Kelso, T.S. "A New Way to Obtain GP Data (aka TLEs)" https://celestrak.com/NORAD/documentation/gp-data-formats.php """ # Assemble query, raise an error if malformed url = _generate_url(catalog_number, international_designator, name) # Make API call, raise an error if data is malformed fields = _make_query(url) # Initialize and return Satrec object sat = Satrec() omm.initialize(sat, fields) return sat
def test_omm_csv_matches_old_tle(): line0, line1, line2 = VANGUARD_TLE.splitlines() sat1 = Satrec.twoline2rv(line1, line2) fields = next(omm.parse_csv(StringIO(VANGUARD_CSV))) sat2 = Satrec() omm.initialize(sat2, fields) assert_satellites_match(sat1, sat2)