Skip to content

Commit fc1db62

Browse files
Show how to print out leap second table
1 parent 5224755 commit fc1db62

File tree

4 files changed

+48
-5
lines changed

4 files changed

+48
-5
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ v1.35 — 2020 December 31
301301
(The old method will remain in place to support legacy code,
302302
but is discouraged in new applications.)
303303

304-
* The effects of :ref:`Polar motion` — if configured — are now included
304+
* The effects of :ref:`polar-motion` — if configured — are now included
305305
both when computing the position in space of an Earth latitude and longitude,
306306
and when determining the latitude and longitude beneath a celestial position.
307307

@@ -329,7 +329,7 @@ v1.34 — 2020 December 10
329329

330330
* Added an official :class:`~skyfield.framelib.itrs` reference frame.
331331

332-
* Added support for IERS :ref:`polar motion` 𝑥 and 𝑦.
332+
* Added support for IERS :ref:`polar-motion` 𝑥 and 𝑦.
333333

334334
* Added a method :meth:`~skyfield.toposlib.GeographicPosition.lst_hours_at()`
335335
that computes Local Sidereal Time.

skyfield/documentation/accuracy-efficiency.rst

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ This document is a work in progress,
77
that will be expanded into a full guide.
88
Right now it covers only one topic.
99

10-
.. _polar motion:
11-
1210
-----------------------
1311
Precession and Nutation
1412
-----------------------
@@ -41,6 +39,8 @@ into the Earth equatorial coordinate system of that date and time.
4139
See the section on :ref:`Coordinates:Rotation Matrices`
4240
for a guide to using a rotation matrix.
4341

42+
.. _polar-motion:
43+
4444
------------
4545
Polar Motion
4646
------------
@@ -108,6 +108,46 @@ simply install the IERS tables on your timescale object
108108
as shown in the example code above.
109109
Polar motion will be used everywhere that it applies.
110110

111+
.. _the-leap-second-table:
112+
113+
---------------------
114+
The leap second table
115+
---------------------
116+
117+
If you want to double-check that Skyfield’s leap second table
118+
agrees with other tools or software,
119+
you can easily print it out.
120+
Each timescale object offers an array of Julian dates ``leap_dates``
121+
and another array of the same length named ``leap_offsets``
122+
that offers the difference between UTC and TAI in seconds:
123+
124+
.. testcode::
125+
126+
ts = load.timescale()
127+
for jd, offset in zip(ts.leap_dates, ts.leap_offsets):
128+
ymd = ts.tt_jd(jd).tt_strftime('%Y-%m-%d')
129+
print(jd, ymd, '{:+}'.format(int(offset)))
130+
131+
.. testoutput::
132+
133+
2441499.5 1972-07-01 +11
134+
2441683.5 1973-01-01 +12
135+
2442048.5 1974-01-01 +13
136+
...
137+
2456109.5 2012-07-01 +35
138+
2457204.5 2015-07-01 +36
139+
2457754.5 2017-01-01 +37
140+
141+
Note that each leap second occurs just before
142+
the Julian date given in the table.
143+
Taking the second row as an example,
144+
the offset between TAI and UTC increased to +12
145+
at the first moment of the day 1973-01-01.
146+
It did so because that day was immediately preceded by a leap second
147+
that was attached to the *previous* day as its final second.
148+
So the leap second followed the normal, non-leap second 1972-12-31 12:59:59
149+
and had the special designation 1972-12-31 12:59:60.
150+
111151
----------------------------------
112152
Bad performance and using 100% CPU
113153
----------------------------------

skyfield/documentation/time.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,9 @@ while keeping UTC synchronized with the Earth
335335
is to occasionally add an extra leap second
336336
to one of the year’s minutes.
337337

338+
See :ref:`the-leap-second-table` if you are interested
339+
in printing Skyfield’s full list of leap seconds.
340+
338341
The `International Earth Rotation Service <http://hpiers.obspm.fr/>`_
339342
currently restricts itself to appending a leap second
340343
to the last minute of June or the last minute of December.

skyfield/positionlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def hadec(self):
293293
Because this declination is measured from the plane of the
294294
Earth’s physical geographic equator, it will be slightly
295295
different than the declination returned by ``radec()`` if you
296-
have loaded a :ref:`polar motion` file.
296+
have loaded a :ref:`polar-motion` file.
297297
298298
The coordinates are not adjusted for atmospheric refraction near
299299
the horizon.

0 commit comments

Comments
 (0)