def test_tle_to_and_from(): txt = """1 25544U 98067A 08264.51782528 -.00002182 00000-0 -11606-4 0 2927 2 25544 51.6416 247.4627 0006703 130.5360 325.0288 15.72125391563537""" orb = Tle(txt).orbit() new_txt = Tle.from_orbit(orb, norad_id=25544, cospar_id='1998-067A') assert str(new_txt) == txt
def test_to_and_from(both): tle = Tle(both) orb = tle.orbit() orb2 = orb.copy() del orb2._data["cospar_id"] tle2 = Tle.from_orbit(orb, name=tle.name, norad_id=tle.norad_id, cospar_id=tle.cospar_id) tle3 = Tle.from_orbit(orb2, name=tle.name, norad_id=tle.norad_id) assert tle2.cospar_id == tle.cospar_id assert tle3.cospar_id == "" tle, tle2 = tle.text.splitlines(), tle2.text.splitlines() for i in range(2): # We don't test the last two fields of the TLE because when we reconstruct one from scracth # we can't have any information about the element set number. And because of that, the # checksum is also different assert tle[i][:63] == tle2[i][:63]
def test_tle(tle, ccsds_format): # Check that a TLE and its OMM representation are the same txt = dumps(tle, fmt=ccsds_format) orb = loads(txt) new_tle = Tle.from_orbit(orb) assert str(tle.tle) == str(new_tle) assert all(tle == orb) date = Date(2020, 9, 30) assert all(tle.propagate(date) == orb.propagate(date))