def unix_to_era(unix_time): """Calculate the Earth Rotation Angle for a given time. The Earth Rotation Angle is the angle between the Celetial and Terrestrial Intermediate origins, and is a modern replacement for the Greenwich Sidereal Time. Parameters ---------- unix_time : float or array of. Unix/POSIX time. Returns ------- era : float or array of The Earth Rotation Angle in degrees. """ from skyfield import earthlib t = unix_to_skyfield_time(unix_time) era = earthlib.earth_rotation_angle(t.ut1) # in cycles return 360.0 * era
def unix_to_era(unix_time): """Calculate the Earth Rotation Angle for a given time. The Earth Rotation Angle is the angle between the Celetial and Terrestrial Intermediate origins, and is a modern replacement for the Greenwich Sidereal Time. Parameters ---------- unix_time : float or array of. Unix/POSIX time. Returns ------- era : float or array of The Earth Rotation Angle in degrees. """ from skyfield import earthlib t = unix_to_skyfield_time(unix_time) era = earthlib.earth_rotation_angle(t.ut1) # in cycles return (360.0 * era)
def test_earth_rotation_angle(): epsilon = 1e-12 a0 = c.era(T0) aA = c.era(TA) aB = c.era(TB) t = array([T0, TA, TB]) v = earthlib.earth_rotation_angle(t) eq(v, [a0, aA, aB], epsilon)
def test_earth_rotation_angle(self): self.delta = 1e-12 a0 = c.era(T0) aA = c.era(TA) aB = c.era(TB) t = array([T0, TA, TB]) v = earthlib.earth_rotation_angle(t) self.eq(v, [a0, aA, aB])
def test_lsa_skyfield(self): # Check an lsa calculated by caput.time against one calculated by PyEphem from skyfield import earthlib, api dt = datetime(2014, 10, 2, 13, 4, 5) dt_utc = dt.replace(tzinfo=api.utc) t1 = ctime.datetime_to_unix(dt) obs = ctime.Observer(42.8, 4.7) lsa1 = obs.unix_to_lsa(t1) t = ctime.skyfield_wrapper.timescale.utc(dt_utc) lsa2 = (earthlib.earth_rotation_angle(t.ut1) * 360.0 + obs.longitude) % 360.0 self.assertAlmostEqual(lsa1, lsa2, 4)
def test_cirs_era(): ts = api.load.timescale() st = ts.utc(year=np.arange(1951, 2051)) planets = api.load('de421.bsp') pos = planets['earth'] + api.Topos(longitude_degrees=0.0, latitude_degrees=0.0) # Get the TIO tio = pos.at(st).from_altaz(alt_degrees=90, az_degrees=180) # Get the TIOs RA in CIRS coordinates, and the Earth Rotation Angle tio_ra, tio_dec, _ = tio.cirs_radec(st) era = 360.0 * earth_rotation_angle(st.ut1) tol = (1e-8 / 3600.0) # 10 nano arc-second precision assert np.allclose(tio_ra._degrees, era, rtol=0.0, atol=tol) assert np.allclose(tio_dec._degrees, 0.0, rtol=0.0, atol=tol)
def test_cirs_meridian(): ts = api.load.timescale() st = ts.utc(year=2051) planets = api.load('de421.bsp') pos = planets['earth'] + api.Topos(longitude_degrees=0.0, latitude_degrees=0.0) # Get a series of points along the meridian alt = np.arange(1, 90) meridian = pos.at(st).from_altaz(alt_degrees=alt, az_degrees=0.0) # Get the TIOs RA in CIRS coordinates, and the Earth Rotation Angle md_ra, md_dec, _ = meridian.cirs_radec(st) era = 360.0 * earth_rotation_angle(st.ut1) tol = (1e-7 / 3600.0) # 100 nano arc-second precision assert np.allclose(md_ra._degrees, era, rtol=0.0, atol=tol) assert np.allclose(md_dec._degrees, 90 - alt, rtol=0.0, atol=tol)
def test_earth_rotation_angle(jd_float_or_vector): jd_ut1 = jd_float_or_vector u = c.era(jd_ut1) v = earthlib.earth_rotation_angle(jd_ut1) epsilon = 1e-12 # degrees; 14 to 15 digits of agreement eq(u, v, epsilon)