File: iers.rst

package info (click to toggle)
astroplan 0.10.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,024 kB
  • sloc: python: 4,411; makefile: 126
file content (134 lines) | stat: -rw-r--r-- 5,823 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
.. doctest-skip-all

.. _iers:

**************************************************
What are the IERS tables and how do I update them?
**************************************************

Contents
========

* :ref:`iers-Background`
* :ref:`iers-What_are_IERS_Bulletins_A_and_B`
* :ref:`iers-How_do_I_get_IERS_Bulletin_A_for_astroplan?`

.. _iers-Background:

Background
==========

Keeping accurate, consistent time systems is rough. We intuitively want
time to be described by a continuous cyclic clock like the clock on your
wall or the calendar, but the Earth's rate of rotation varies measurably
on human timescales. As a result, the time measured by an atomic clock and
the time that you would infer from measuring how long it has been since the
last solar noon are constantly becoming offset from one another with
stochastic changes in Earth's moment of inertia and slowly acting tidal forces.

For this reason, there is a time system that keeps track of seconds like an
atomic clock, TAI, a more commonly used one that works like an atomic clock
with a varying offset of some integer number of seconds, UTC, and one that
matches up with the Earth's rotation, UT1. The difference between UT1 and UTC is
constantly changing as the Earth's rotation changes and as leap seconds get
added to UTC to compensate.

In order to accurately predict the apparent position of a celestial object from
the Earth, for example in altitude and azimuth coordinates, one needs to know
the orientation of the Earth at any point in time, and since the Earth's
rotation does not change in a predictable way, we must rely on observations
of the Earth's orientation as a function of time to accurately calculate
UT1-UTC.

.. _iers-What_are_IERS_Bulletins_A_and_B:

What are IERS Bulletins A and B?
================================

The `International Earth Rotation and Reference Systems Service (IERS)
<http://www.iers.org/>`_ is responsible for measuring the Earth's orientation as
a function of time, and making predictions for the Earth's orientation in the
near future (accounting for scheduled leap seconds). The data products released
by the IERS used by astroplan are the IERS Bulletins A and B.

* IERS Bulletin B is a table with Earth orientation observations from the last
  few decades up through nearly the present time. `Astropy <https://astropy.org>`__ relies on IERS B to
  compute UT1-UTC, and by default will raise an error if you try to compute
  UT1-UTC for a time that is outside the bounds of the IERS Bulletin B table
  (see the `Astropy <https://astropy.org>`__ docs on the `UT1/UTC transformation offsets
  <http://astropy.readthedocs.io/en/latest/time/index.html?highlight=iers#transformation-offsets>`_
  for more details), like this::

    >>> from astropy.time import Time
    >>> Time('2040-01-01', scale='utc').ut1    # Convert from UTC to UT1
    IndexError: (some) times are outside of range covered by IERS table.

* IERS Bulletin A encompasses the observations of recent Earth orientation
  contained in Bulletin B, while also making extrapolations into the past,
  before the Bulletin B tables begin, and into the future, after the Bulletin
  B tables end. The future predictions include leap second additions scheduled
  to be added.

Let's plot the UT1-UTC from IERS Bulletins A and B to show the difference using
astropy's IERS machinery:

.. plot::

    import matplotlib.pyplot as plt
    import numpy as np
    import astropy.units as u
    from astropy.time import Time
    from urllib.error import HTTPError

    # Download and cache the IERS Bulletins A and B  using astropy's machinery
    # (reminder: astroplan has its own function for this: `download_IERS_A`)
    from astropy.utils.iers import (IERS_A, IERS_A_URL, IERS_B, IERS_B_URL,
                                    FROM_IERS_B, IERS_Auto)
    from astropy.utils.data import download_file
    # Workaround until astropy/astropy#5194 is solved
    iers_a = IERS_Auto.open()
    iers_b = IERS_B.open(download_file(IERS_B_URL, cache=True))

    # Get a range of times to plot from 1990-2022
    time_range = Time("1990-01-01") + np.arange(0, 30, 0.2)*u.year

    # Calculate the difference between UTC and UT1 at those times,
    # allowing times "outside of the table"
    DUT1_a, success_a = time_range.get_delta_ut1_utc(return_status=True,
                                                     iers_table=iers_a)
    DUT1_b, success_b = time_range.get_delta_ut1_utc(return_status=True,
                                                     iers_table=iers_b)

    # Compare input times to the times available in the table. For details, see
    # https://docs.astropy.org/en/stable/utils/iers.html
    measurements_from_b = (success_b == FROM_IERS_B)

    # Make a plot of the time difference
    fig, ax = plt.subplots(figsize=(10,8))
    ax.axhline(0, color='gray', ls='--', lw=2)

    ax.plot_date(time_range.plot_date,
                 DUT1_a, '-', lw=2, label='IERS Bulletin A + extrapolation')
    ax.plot_date(time_range.plot_date[measurements_from_b],
                 DUT1_b[measurements_from_b], 'r--', lw=2, label='IERS Bulletin B')
    ax.set(xlabel='Year', ylabel='UT1-UTC [seconds]')
    ax.legend(loc='upper right')
    plt.show()


.. _iers-How_do_I_get_IERS_Bulletin_A_for_astroplan?:

How do I get IERS Bulletin A for astroplan?
===========================================

Without downloading IERS Bulletin A, astroplan simply approximates UT1-UTC=0
always. This will lead to lower precision position and time calculations
on the order of arcseconds or seconds, and allow you to handle times in the
far future and distant past.

To download the IERS Bulletin A table for the first time, or to refresh the
cached version that you already have, simply run::

    from astroplan import download_IERS_A
    download_IERS_A()