def __init__(self, utc, longitude, latitude, altitude): try: super().__init__(longitude, latitude, altitude) except TypeError: super(TimeScale, self).__init__(longitude, latitude, altitude) self.utc = utc self.utc1, self.utc2 = strputc(self.utc) self.tai1, self.tai2 = erfa.utctai(self.utc1, self.utc2) self.tt1, self.tt2 = erfa.taitt(self.tai1, self.tai2) self.tcg1, self.tcg2 = erfa.tttcg(self.tt1, self.tt2) self.dut1 = -0.1 if (self.utc1+self.utc2) >= 2456708.5: self.dut1 = -0.2 elif (self.utc1+self.utc2) >= 2456785.5: self.dut1 = -0.3 elif (self.utc1+self.utc2) >= 2456925.5: self.dut1 = -0.4 self.dt = 35+32.184-self.dut1 self.ut11, self.ut12 = erfa.utcut1(self.utc1, self.utc2, self.dut1) # Extract fraction for TDB-TT calculation, later. self.ut = math.fmod(math.fmod(self.ut11,1.0)+math.fmod(self.ut12,1.0),1.0) # TDB-TT (using TT as a substitute for TDB). self.dtr = erfa.dtdb(self.tt1, self.tt2, self.ut, self.elon, self.u, self.v) self.tdb1, self.tdb2 = erfa.tttdb(self.tt1, self.tt2, self.dtr) self.tcb1, self.tcb2 = erfa.tdbtcb(self.tdb1, self.tdb2)
# transform into intenal format utc1, utc2 = erfa.dtf2d("UTC", iy,mo,d,ih,im,sec) # UT1-UTC from IERS dut = np.array([.3341]) # UTC -> UT1 ut11, ut12 = erfa.utcut1(utc1, utc2, dut) # Extract fraction for TDB-TT calculation, later. ut = np.array([math.fmod(math.fmod(ut11,1.0)+math.fmod(ut12,1.0),1.0)]) # UTC -> TAI -> TT -> TCG tai1, tai2 = erfa.utctai(utc1, utc2) tt1, tt2 = erfa.taitt(tai1, tai2) tcg1, tcg2 = erfa.tttcg(tt1, tt2) # TDB-TT (using TT as a substitute for TDB). dtr = erfa.dtdb(tt1, tt2, ut, elon, u, v) # TT -> TDB -> TCB. tdb1, tdb2 = erfa.tttdb(tt1, tt2, dtr) tcb1, tcb2 = erfa.tdbtcb(tdb1, tdb2) # report y, m, d, h = erfa.d2dtf('utc', 6, utc1, utc2) for i in range(len(y)): print("UTC : %4d/%2.2d/%2.2d, "%(y[i],m[i],d[i]), end =' ') print("%3d:%2.2d:%2.2d.%3.3d"%tuple(h[i])) y, m, d, h = erfa.d2dtf("ut1", 6, ut11, ut12) for i in range(len(y)):
# transform into intenal format utc1, utc2 = erfa.dtf2d(iy, mo, d, ih, im, sec, "UTC") # UT1-UTC from IERS dut = .3341 # UTC -> UT1 ut11, ut12 = erfa.utcut1(utc1, utc2, dut) # Extract fraction for TDB-TT calculation, later. ut = math.fmod(math.fmod(ut11, 1.0) + math.fmod(ut12, 1.0), 1.0) # UTC -> TAI -> TT -> TCG tai1, tai2 = erfa.utctai(utc1, utc2) tt1, tt2 = erfa.taitt(tai1, tai2) tcg1, tcg2 = erfa.tttcg(tt1, tt2) # TDB-TT (using TT as a substitute for TDB). dtr = erfa.dtdb(tt1, tt2, ut, elon, u, v) # TT -> TDB -> TCB. tdb1, tdb2 = erfa.tttdb(tt1, tt2, dtr) tcb1, tcb2 = erfa.tdbtcb(tdb1, tdb2) # report print("UTC %5d/%2.2d/%2.2d%3d:%2.2d:%2.2d.%6.6d" % erfa.d2dtf(6, utc1, utc2)) print("UT1 %5d/%2.2d/%2.2d%3d:%2.2d:%2.2d.%6.6d" % erfa.d2dtf(6, ut11, ut12, "ut1")) print("TAI %5d/%2.2d/%2.2d%3d:%2.2d:%2.2d.%6.6d" % erfa.d2dtf(6, tai1, tai2, "tai")) print("TT %5d/%2.2d/%2.2d%3d:%2.2d:%2.2d.%6.6d" %