Beispiel #1
0
def test_timescale_with_old_fashioned_leap_second_table():
    # Skyfield no longer uses the awkward old-style leap second table,
    # written before I knew better, with inf's on both ends; but in case
    # any users built such tables and supplied them manually:
    delta_t = array([[2442046.5005113888], [44.4782581]])
    leap_dates = array([-inf, 2441317.5, 2441499.5, 2441683.5, 2442048.5, inf])
    leap_offsets = array([10, 10, 10, 11, 12, 13])
    ts = Timescale(delta_t, leap_dates, leap_offsets)
    t = ts.tai(1973, 1, 1, 0, 0, [11, 12])
    assert t.utc.T.tolist() == [
        [1972, 12, 31, 23, 59, 60],
        [1973, 1, 1, 0, 0, 0],
    ]

    # The offset prior to the first leap second should be +10.
    t = ts.tai(1970, 1, 1)
    assert t.utc == (1969, 12, 31, 23, 59, 50)
def test_build_timescale_arrays():
    mjd = array([42046.00, 42047.00, 42048.00, 42049.00])
    dut1 = array([-0.2942581, -0.2971424, 0.6999438, 0.6970539])
    daily_tt, daily_delta_t, leap_dates, leap_offsets = (
        iers.build_timescale_arrays(mjd, dut1))

    assert list(daily_tt) == [
        2442046.5005113888, 2442047.5005113888, 2442048.500522963,
        2442049.500522963
    ]
    assert list(daily_delta_t) == [
        44.4782581, 44.4811424, 44.4840562, 44.4869461
    ]
    assert list(leap_dates) == [2441499.5, 2441683.5, 2442048.5]
    assert list(leap_offsets) == [11, 12, 13]

    ts = Timescale((daily_tt, daily_delta_t), leap_dates, leap_offsets)
    t = ts.tai(1973, 1, 1, 0, 0, [11, 12])
    assert t.utc.T.tolist() == [
        [1972, 12, 31, 23, 59, 60],
        [1973, 1, 1, 0, 0, 0],
    ]
Beispiel #3
0
def test_iss_altitude_computed_with_gcrs(iss_transit):
    dt, their_altitude = iss_transit

    cst = timedelta(hours=-6)  #, minutes=1)
    dt = dt - cst
    jd = Timescale(delta_t=67.2091).utc(dt)

    lines = iss_tle.splitlines()
    s = EarthSatellite(lines, None)
    lake_zurich = api.Topos(latitude_degrees=42.2, longitude_degrees=-88.1)

    alt, az, d = lake_zurich.at(jd).observe(s).altaz()
    print(dt, their_altitude, alt.degrees, their_altitude - alt.degrees)
    assert abs(alt.degrees - their_altitude) < 2.5  # TODO: tighten this up?
Beispiel #4
0
def test_iss_altitude_computed_with_bcrs(iss_transit):
    dt, their_altitude = iss_transit

    cst = timedelta(hours=-6)  #, minutes=1)
    dt = dt - cst
    jd = Timescale(delta_t=67.2091).utc(dt)

    lines = iss_tle.splitlines()
    s = EarthSatellite(lines, None)
    earth = api.load('de421.bsp')['earth']
    lake_zurich = earth.topos(latitude_degrees=42.2, longitude_degrees=-88.1)

    # Compute using Solar System coordinates:

    alt, az, d = lake_zurich.at(jd).observe(s).altaz()
    print(dt, their_altitude, alt.degrees, their_altitude - alt.degrees)
    assert abs(alt.degrees - their_altitude) < 2.5  # TODO: tighten this up?
Beispiel #5
0
 def string(self, timescale: Timescale):
     if self.inner is None:
         return ""
     t = timescale.tt_jd(self.inner + 3 / 24)
     return "{}-{:02d}-{:02d} {:02d}:{:02d}".format(*t.ut1_calendar())
Beispiel #6
0
def ts():
    yield Timescale()
Beispiel #7
0
def test_JulianDate_init(time_parameter, time_value):
    method = getattr(Timescale(), time_parameter)
    jd = method(time_value)
    assert getattr(jd, time_parameter) == 2441700.56640625