def test_era(self): """Comare ERA relative to erfa.era00 test case.""" t = Time(2400000.5, 54388.0, format='jd', location=(0, 0), scale='ut1') era = t.earth_rotation_angle() expected = 0.4022837240028158102 * u.radian # Without the TIO locator/polar motion, this should be close already. assert np.abs(era - expected) < 1e-10 * u.radian # And with it, one should reach full precision. sp = erfa.sp00(t.tt.jd1, t.tt.jd2) iers_table = iers.earth_orientation_table.get() xp, yp = [c.to_value(u.rad) for c in iers_table.pm_xy(t)] r = erfa.rx(-yp, erfa.ry(-xp, erfa.rz(sp, np.eye(3)))) expected1 = expected + (np.arctan2(r[0, 1], r[0, 0]) << u.radian) assert np.abs(era - expected1) < 1e-12 * u.radian # Now try at a longitude different from 0. t2 = Time(2400000.5, 54388.0, format='jd', location=(45, 0), scale='ut1') era2 = t2.earth_rotation_angle() r2 = erfa.rz(np.deg2rad(45), r) expected2 = expected + (np.arctan2(r2[0, 1], r2[0, 0]) << u.radian) assert np.abs(era2 - expected2) < 1e-12 * u.radian
GST = erfa.anp(erfa.gmst82(DJMJD0 + DATE, TUT) + EE) print("GST = %.17f radians" % GST) print(" = %.17f degrees" % math.degrees(GST)) print(" = %s%dd%dm%d.%ds" % erfa.a2af(6, GST)) print(" = %s%dh%dm%d.%ds" % erfa.a2tf(6, GST)) # Form celestial-terrestrial matrix (no polar motion yet). ##RC2TI = erfa.cr(RNPB) ##RC2TI = erfa.rz(GST, RC2TI) RC2TI = erfa.rz(GST, RNPB) print("celestial to terrestrial matrix (no polar motion)") pprint(RC2TI) # Polar motion matrix (TIRS->ITRS, IERS 1996). RPOM = erfa.ir() RPOM = erfa.rx(-YP, RPOM) RPOM = erfa.ry(-XP, RPOM) # Form celestial-terrestrial matrix (including polar motion). RC2IT = erfa.rxr(RPOM, RC2TI) print("celestial to terrestrial matrix (including polar motion)") pprint(RC2IT) ##A = scipy.matrix(RC2IT) print(''' ============================================ IAU 2000A, CIO based, using classical angles ============================================ ''') # CIP and CIO, IAU 2000A.
GST = erfa.anp(erfa.gmst82(DJMJD0+DATE, TUT) + EE) print("GST = %.17f radians"%GST) print(" = %.17f degrees"%math.degrees(GST)) print(" = %s%dd%dm%d.%ds"%erfa.a2af(6, GST)) print(" = %s%dh%dm%d.%ds"%erfa.a2tf(6, GST)) # Form celestial-terrestrial matrix (no polar motion yet). ##RC2TI = erfa.cr(RNPB) ##RC2TI = erfa.rz(GST, RC2TI) RC2TI = erfa.rz(GST, RNPB) print("celestial to terrestrial matrix (no polar motion)") pprint(RC2TI) # Polar motion matrix (TIRS->ITRS, IERS 1996). RPOM = erfa.ir() RPOM = erfa.rx(-YP, RPOM) RPOM = erfa.ry(-XP, RPOM) # Form celestial-terrestrial matrix (including polar motion). RC2IT = erfa.rxr(RPOM, RC2TI) print("celestial to terrestrial matrix (including polar motion)") pprint(RC2IT) ##A = scipy.matrix(RC2IT) print(''' ============================================ IAU 2000A, CIO based, using classical angles ============================================ ''') # CIP and CIO, IAU 2000A.
print(" = %s"%c, end='') print("%dd%dm%d.%ds"%tuple(a)) for c,a in erfa.a2tf(6, GST): print(" = %s"%c, end='') print("%dh%dm%d.%ds"%tuple(a)) # Form celestial-terrestrial matrix (no polar motion yet). ##RC2TI = erfa.cr(RNPB) ##RC2TI = erfa.rz(GST, RC2TI) RC2TI = erfa.rz(GST, RNPB) print("celestial to terrestrial matrix (no polar motion)") pprint(RC2TI) # Polar motion matrix (TIRS->ITRS, IERS 1996). RPOM = np.array([np.identity(3)]) ##erfa.ir() RPOM = erfa.rx(np.array([-YP]), RPOM) RPOM = erfa.ry(np.array([-XP]), RPOM) # Form celestial-terrestrial matrix (including polar motion). RC2IT = erfa.rxr(RPOM, RC2TI) print("celestial to terrestrial matrix (including polar motion)") pprint(RC2IT) ##A = scipy.matrix(RC2IT) print(''' ============================================ IAU 2000A, CIO based, using classical angles ============================================ ''') # CIP and CIO, IAU 2000A.