Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
print('''UTC to TT
transform 2010 July 24, 11:18:07.318 (UTC) into Terrestrial Time (TT)
and report it rounded to 1ms precision''')
# encode UTC date and time into internal format
u1, u2 = erfa.dtf2d('utc',
                    np.array([2010]),
                    np.array([7]),
                    np.array([24]),
                    np.array([11]),
                    np.array([18]),
                    np.array([7.318]))

# transform UTC to TAI, then TAI to TT
a1, a2 = erfa.utctai(u1, u2)
t1, t2 = erfa.taitt(a1, a2)

# decode and report the TT
y, m, d, h = erfa.d2dtf('TT', 3, t1, t2)
print("UTC: 2010 July 24, 11:18:07.318")
for i in range(len(y)):
    print("TT : %4d/%2.2d/%2.2d, "%(y[i],m[i],d[i]), end =' ')
    print("%3d:%2.2d:%2.2d.%3.3d"%tuple(h[i]))

print('=====')

print('''
TAI to UTC
take a time expressed as TAI, encode it into
the internal format and transform it into UTC''')
Ejemplo n.º 3
0
# Effective color (microns).
wl = np.array([0.55])

# UTC date
y = np.array([2013], dtype="int32")
m = np.array([4], dtype="int32")
d = np.array([2], dtype="int32")
h = np.array([23], dtype="int32")
mn = np.array([15], dtype="int32")
sec = np.array([43.55])
utc1, utc2 = erfa.dtf2d("UTC", y, m, d, h, mn, sec)

# TT date
tai1, tai2 = erfa.utctai(utc1, utc2)
tt1, tt2 = erfa.taitt(tai1, tai2)

# EOPs: polar motion in radians, UT1-UTC in seconds.
xp = np.array([50.995e-3 * erfa.DAS2R])
yp = np.array([376.723e-3 * erfa.DAS2R])
dut1 = np.array([155.0675e-3])
##print('xp, yp', xp, yp)
# Corrections to IAU 2000A CIP (radians).
dx = 0.269e-3 * erfa.DAS2R
dy = -0.274e-3 * erfa.DAS2R

# Star ICRS RA,Dec (radians).
rc = erfa.tf2a(np.array([[14, 34, 16.81183]]))
dc = erfa.af2a(np.array([[-12, 31, 10.3965]]))
##print('rc, dc', rc,dc)
#
Ejemplo n.º 4
0
# -*- coding: utf-8 -*-
'''SOFA example, from sofa_ts_c.pdf
'''
from __future__ import print_function
import math
import erfa

print('''UTC to TT
transform 2010 July 24, 11:18:07.318 (UTC) into Terrestrial Time (TT)
and report it rounded to 1ms precision''')
# encode UTC date and time into internal format
u1, u2 = erfa.dtf2d(2010, 7, 24, 11, 18, 7.318)

# transform UTC to TAI, then TAI to TT
a1, a2 = erfa.utctai(u1, u2)
t1, t2 = erfa.taitt(a1, a2)

# decode and report the TT
y, m, d, h, mn, sc, f = erfa.d2dtf(3, t1, t2)
print("UTC: 2010 July 24, 11:18:07.318")
print("TT: %4d/%2.2d/%2.2d%3d:%2.2d:%2.2d.%3.3d" % (y, m, d, h, mn, sc, f))

print('=====')

print('''
TAI to UTC
take a time expressed as TAI, encode it into
the internal format and transform it into UTC''')

# encode TAI date and time into internal format
a1, a2 = erfa.dtf2d(2009, 1, 1, 0, 0, 33.7, "TAI")
Ejemplo n.º 5
0
hm = 625.0

# Ambient pressure (HPa), temperature (C) and rel. humidity (frac).
phpa = 952.0
tc = 18.5
rh = 0.83

# Effective color (microns).
wl = 0.55

# UTC date
utc1, utc2 = erfa.dtf2d(2013, 4, 2, 23, 15, 43.55, "UTC")

# TT date
tai1, tai2 = erfa.utctai(utc1, utc2)
tt1, tt2 = erfa.taitt(tai1, tai2)

# EOPs: polar motion in radians, UT1-UTC in seconds.
xp = 50.995e-3 * erfa.DAS2R
yp = 376.723e-3 * erfa.DAS2R
dut1 = 155.0675e-3
##print('xp, yp', xp, yp)
# Corrections to IAU 2000A CIP (radians).
dx = 0.269e-3 * erfa.DAS2R
dy = -0.274e-3 * erfa.DAS2R

# Star ICRS RA,Dec (radians).
rc = erfa.tf2a(14, 34, 16.81183)
dc = erfa.af2a(-12, 31, 10.3965)
##print('rc, dc', rc,dc)
#