IERS Data for Astropy
astropy-iers-data is a data package that provides International Earth Rotation and Reference Systems Service (IERS) tables, including Earth Rotation Parameters (ERP) and leap second data. It is specifically designed to be consumed by the `astropy` core library, allowing `astropy.time` and `astropy.coordinates` to perform accurate time and coordinate transformations without needing to download IERS data from external sources at runtime. The current version is 0.2026.4.6.0.54.57, and its releases are typically tied to updates in the IERS data itself.
Warnings
- gotcha If `astropy-iers-data` is installed, `astropy` will prioritize its bundled IERS data over fresh online data unless `astropy.utils.iers.conf.auto_download` is explicitly set to `True`. This can lead to computations using outdated IERS data if the package is not regularly updated.
- gotcha This package provides data for `astropy` and has no standalone functionality or public API. Attempting to import symbols directly from `astropy_iers_data` (other than the implicit module import) will result in an `ImportError` or other unexpected behavior as it's not designed for direct code interaction.
- breaking While `astropy-iers-data` is primarily data, older versions might not be compatible with significant changes in `astropy`'s IERS data handling mechanisms or data formats. This could potentially lead to errors or incorrect results during time or coordinate transformations.
Install
-
pip install astropy-iers-data astropy
Imports
- IERS_Data_Provider_Mechanism
import astropy_iers_data
Quickstart
import astropy.time as atime
import astropy.units as u
from astropy.utils import iers
import os
# Ensure astropy-iers-data is installed for local data access
# For demonstration, we'll try to prevent online download if possible.
# In a real scenario, you might want auto_download=True for freshest data.
# Temporarily set auto_download to False to ensure bundled data is preferred
# (if astropy-iers-data is installed and current enough).
# If astropy-iers-data is not present or too old, this might fail.
original_auto_download = iers.conf.auto_download
iers.conf.auto_download = False
try:
# Create a Time object that requires IERS data (e.g., UTC to TAI/TT conversion)
t = atime.Time('2023-01-01 00:00:00', scale='utc', format='isot')
# Access a property that triggers IERS data lookup, e.g., TT
# This operation implicitly uses the IERS tables.
tt_time = t.tt
print(f"UTC Time: {t}")
print(f"TT Time (using IERS data): {tt_time}")
# Demonstrate using Earth rotation parameters (requires IERS data)
xp_val = iers.IERS_A.pm_x(t.mjd).to(u.arcsec)
yp_val = iers.IERS_A.pm_y(t.mjd).to(u.arcsec)
print(f"Pole motion x (xp) at {t.iso}: {xp_val}")
print(f"Pole motion y (yp) at {t.iso}: {yp_val}")
print("Successfully accessed IERS data, likely from astropy-iers-data if auto_download was False.")
except Exception as e:
print(f"An error occurred, potentially indicating missing or outdated IERS data: {e}")
finally:
# Restore original auto_download setting
iers.conf.auto_download = original_auto_download