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)
# UTC date and time iy = np.array([2006]) mo = np.array([1]) d = np.array([15]) ih = np.array([21]) im = np.array([24]) sec = np.array([37.5]) # 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)
# UTC date and time iy = 2006 mo = 1 d = 15 ih = 21 im = 24 sec = 37.5 # 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)