IERS Data for Astropy

0.2026.4.6.0.54.57 · active · verified Fri Apr 10

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

Install

Imports

Quickstart

This quickstart demonstrates how `astropy` uses the IERS data provided by `astropy-iers-data`. It explicitly tries to use local data by setting `astropy.utils.iers.conf.auto_download = False` and then performs time transformations and accesses Earth Rotation Parameters that rely on these tables. If successful, it confirms the IERS data is being consumed.

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

view raw JSON →