def test_appendix_c_satellite(): ts = api.load.timescale() lines = appendix_c_example.splitlines() sat = EarthSatellite(lines[1], lines[2], lines[0], ts) jd_epoch = sat.model.jdsatepoch + sat.model.jdsatepochF three_days_later = jd_epoch + 3.0 offset = ts.tt(jd=three_days_later)._utc_float() - three_days_later t = ts.tt(jd=three_days_later - offset) # First, a crucial sanity check (which is, technically, a test of # the `sgp4` package and not of Skyfield): are the right coordinates # being produced by our Python SGP4 propagator for this satellite? rTEME, vTEME, error = sat._position_and_velocity_TEME_km(t) # TODO: This used to be accurate to within 1e-8 but lost precision # with the move to SGP4 2.0. Is the difference an underlying change # in the algorithm and its results? Or something else? epsilon = 1e-4 assert abs(-9060.47373569 - rTEME[0]) < epsilon assert abs(4658.70952502 - rTEME[1]) < epsilon assert abs(813.68673153 - rTEME[2]) < epsilon # TODO: Similar to the above, this used to be 1e-9. epsilon = 1e-8 assert abs(-2.232832783 - vTEME[0]) < epsilon assert abs(-4.110453490 - vTEME[1]) < epsilon assert abs(-3.157345433 - vTEME[2]) < epsilon
def test_appendix_c_satellite(): lines = appendix_c_example.splitlines() ts = api.load.timescale() sat = EarthSatellite(lines[1], lines[2], lines[0], ts) t = ts.tt_jd(sat.epoch.whole + 3.0, sat.epoch.tt_fraction) # First, a crucial sanity check (which is, technically, a test of # the `sgp4` package and not of Skyfield): are the right coordinates # being produced by our Python SGP4 propagator for this satellite? rTEME, vTEME, error = sat._position_and_velocity_TEME_km(t) # TODO: This used to be accurate to within 1e-8 but lost precision # with the move to SGP4 2.0. Is the difference an underlying change # in the algorithm and its results? Or something else? epsilon = 1e-4 assert abs(-9060.47373569 - rTEME[0]) < epsilon assert abs(4658.70952502 - rTEME[1]) < epsilon assert abs(813.68673153 - rTEME[2]) < epsilon # TODO: Similar to the above, this used to be 1e-9. Then the Time # object started storing UTC as seconds, and it got worse. epsilon = 5e-8 assert abs(-2.232832783 - vTEME[0]) < epsilon assert abs(-4.110453490 - vTEME[1]) < epsilon assert abs(-3.157345433 - vTEME[2]) < epsilon
def test_appendix_c_satellite(): lines = appendix_c_example.splitlines() sat = EarthSatellite(lines[1], lines[2], lines[0]) ts = api.load.timescale() jd_epoch = sat.model.jdsatepoch three_days_later = jd_epoch + 3.0 offset = ts.tt(jd=three_days_later)._utc_float() - three_days_later t = ts.tt(jd=three_days_later - offset) # First, a crucial sanity check (which is, technically, a test of # the `sgp4` package and not of Skyfield): are the right coordinates # being produced by our Python SGP4 propagator for this satellite? rTEME, vTEME, error = sat._position_and_velocity_TEME_km(t) assert abs(-9060.47373569 - rTEME[0]) < 1e-8 assert abs(4658.70952502 - rTEME[1]) < 1e-8 assert abs(813.68673153 - rTEME[2]) < 1e-8 assert abs(-2.232832783 - vTEME[0]) < 1e-9 assert abs(-4.110453490 - vTEME[1]) < 1e-9 assert abs(-3.157345433 - vTEME[2]) < 1e-9
def test_appendix_c_satellite(): lines = appendix_c_example.splitlines() sat = EarthSatellite(lines[1], lines[2], lines[0]) ts = api.load.timescale() jd_epoch = sat.model.jdsatepoch three_days_later = jd_epoch + 3.0 offset = ts.tt(jd=three_days_later)._utc_float() - three_days_later t = ts.tt(jd=three_days_later - offset) # First, a crucial sanity check (which is, technically, a test of # the `sgp4` package and not of Skyfield): are the right coordinates # being produced by our Python SGP4 propagator for this satellite? rTEME, vTEME, error = sat._position_and_velocity_TEME_km(t) assert abs(-9060.47373569 - rTEME[0]) < 1e-8 assert abs(4658.70952502 - rTEME[1]) < 1e-8 assert abs(813.68673153 - rTEME[2]) < 1e-8 assert abs(-2.232832783 - vTEME[0]) < 1e-9 assert abs(-4.110453490 - vTEME[1]) < 1e-9 assert abs(-3.157345433 - vTEME[2]) < 1e-9