Update builtin timescale files

And along the way to getting the documentation working again, add a new
subterfuge so tests can call `datetime.now()` and get a stable value.
This commit is contained in:
Brandon Rhodes 2020-04-22 07:48:48 -04:00
parent c3656b4073
commit d80f65730d
8 changed files with 44 additions and 15 deletions

View File

@ -1,10 +1,10 @@
# Value of TAI-UTC in second valid beetween the initial value until
# the epoch given on the next line. The last line reads that NO
# leap second was introduced since the corresponding date
# Updated through IERS Bulletin 58 issued in July 2019
# Updated through IERS Bulletin 59 issued in January 2020
#
#
# File expires on 28 June 2020
# File expires on 28 December 2020
#
#
# MJD Date TAI-UTC (s)

View File

@ -558,3 +558,8 @@
2019 7 1 69.3582
2019 8 1 69.3442
2019 9 1 69.3376
2019 10 1 69.3377
2019 11 1 69.3432
2019 12 1 69.3540
2020 1 1 69.3612
2020 2 1 69.3752

View File

@ -1,10 +1,10 @@
# Value of TAI-UTC in second valid beetween the initial value until
# the epoch given on the next line. The last line reads that NO
# leap second was introduced since the corresponding date
# Updated through IERS Bulletin 58 issued in July 2019
# Updated through IERS Bulletin 59 issued in January 2020
#
#
# File expires on 28 June 2020
# File expires on 28 December 2020
#
#
# MJD Date TAI-UTC (s)

View File

@ -555,3 +555,11 @@
2019 4 1 69.3032
2019 5 1 69.3326
2019 6 1 69.3540
2019 7 1 69.3582
2019 8 1 69.3442
2019 9 1 69.3376
2019 10 1 69.3377
2019 11 1 69.3432
2019 12 1 69.3540
2020 1 1 69.3612
2020 2 1 69.3752

View File

@ -256,12 +256,12 @@ of the phases of twilight using integers:
.. testoutput::
1 2019-11-08T10:40:20Z Start of Astronomical twilight
1 2019-11-08T10:40:19Z Start of Astronomical twilight
2 2019-11-08T11:12:31Z Start of Nautical twilight
3 2019-11-08T11:45:18Z Start of Civil twilight
4 2019-11-08T12:14:15Z Start of Day
3 2019-11-08T22:23:52Z Start of Civil twilight
2 2019-11-08T22:52:49Z Start of Nautical twilight
2 2019-11-08T22:52:48Z Start of Nautical twilight
1 2019-11-08T23:25:34Z Start of Astronomical twilight
0 2019-11-08T23:57:44Z Start of Night
@ -299,7 +299,7 @@ the parameter ``radius_degrees``.
.. testoutput::
2020-02-01T09:29:17Z Rise
2020-02-01T09:29:16Z Rise
2020-02-01T18:42:57Z Set
Solar terms

View File

@ -135,7 +135,7 @@ and 270° if the Sun is to the right of the Moon.
.. testoutput::
238deg 55' 57.0"
238deg 55' 55.3"
The :func:`~skyfield.trigonometry.position_angle_of()` routine
will not only accept the output of :meth:`~skyfield.positionlib.Apparent.altaz()`,
@ -224,7 +224,7 @@ then Skyfield can return its right ascension and declination.
.. testoutput::
13h 41m 14.49s
13h 41m 14.65s
+42deg 05' 50.0"
What latitude and longitude is beneath this right ascension and declination?
@ -265,7 +265,7 @@ creating the position directly.
.. testoutput::
Latitude: 24deg 10' 33.5"
Longitude: 123deg 17' 01.6"
Longitude: 123deg 16' 53.9"
Which geographic location is farther from Earths center?
=========================================================

View File

@ -107,13 +107,13 @@ we will see that it looked for files in the current directory:
Already exists: ./deltat.data
Parsing with: parse_deltat_data()
Does not expire til: 2020-09-01
Does not expire til: 2021-02-01
Already exists: ./deltat.preds
Parsing with: parse_deltat_preds()
Does not expire til: 2021-01-01
Already exists: ./Leap_Second.dat
Parsing with: parse_leap_seconds()
Does not expire til: 2020-07-28
Does not expire til: 2021-01-27
Already exists: ./de421.bsp
Opening with: SpiceKernel

View File

@ -1,13 +1,29 @@
"""Helpers for making Skyfield tests stable."""
import datetime
import datetime as dt
import skyfield.api
import skyfield.timelib
_real_datetime_class = dt.datetime
class datetime(dt.datetime):
_fake_now = None
@staticmethod
def now():
return datetime._fake_now
def setup(utc=(2015, 10, 11, 10)):
# Importing Pandas raises a TypeError once our fake datetime is
# installed. So instead of waiting, let's import it now.
__import__('pandas')
fake_now = dt.datetime(*utc)
skyfield.api.load = skyfield.iokit.Loader('.', verbose=False)
skyfield.timelib.Timescale._utcnow = lambda self: datetime.datetime(*utc)
skyfield.timelib.Timescale._utcnow = lambda self: fake_now
datetime._fake_now = fake_now
dt.datetime = datetime
def teardown():
skyfield.api.load = skyfield.iokit.Loader('.')
skyfield.timelib.Timescale._utcnow = datetime.datetime.utcnow
skyfield.timelib.Timescale._utcnow = dt.datetime.utcnow
dt.datetime = _real_datetime_class