Skip to content

Commit

Permalink
Update IERS_B file and adjust to new-style
Browse files Browse the repository at this point in the history
  • Loading branch information
mhvk committed Feb 14, 2023
1 parent 8b7e479 commit 938dad8
Show file tree
Hide file tree
Showing 8 changed files with 22,442 additions and 22,304 deletions.
50 changes: 50 additions & 0 deletions astropy/utils/iers/data/ReadMe.eopc04
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Table: eopc04.1962-now
================================================================================

from https://hpiers.obspm.fr/iers/eop/eopc04/eopc04.1962-now

# EARTH ORIENTATION PARAMETER (EOP) PRODUCT CENTER CENTER (PARIS OBSERVATORY) - INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE
# EOP (IERS) 20 C04 TIME SERIES consistent with ITRF 2020 - sampled at 0h UTC
# Contact: christian.bizouard@obspm.fr
# Reference Precession-Nutation Model: IAU 2000
# format(4(i4),f10.2,2(f12.6),f12.7,2(f12.6),2(f12.6),f12.7,2(f12.6),f12.7,2(f12.6),2(f12.6),f12.7)
# YR MM DD HH MJD x(") y(") UT1-UTC(s) dX(") dY(") xrt(") yrt(") LOD(s) x Er y Er UT1-UTC Er dX Er dY Er xrt Er yrt Er LOD Er
1962 1 1 0 37665.00 -0.012700 0.213000 0.0326338 0.000000 0.000000 0.000000 0.000000 0.0017230 0.030000 0.030000 0.0020000 0.004774 0.002000 0.000000 0.000000 0.0014000
# 345678901234567890123456789012345678901234567890123456789012345678901234567890
================================================================================

File Summary:
--------------------------------------------------------------------------------
FileName Lrecl Records Explanations
--------------------------------------------------------------------------------
ReadMe 80 . This file, made using header
eopc04.1962-now 218 22301 All EOP values since 01 January 1962
--------------------------------------------------------------------------------

================================================================================
Byte-by-byte Description of file: *
--------------------------------------------------------------------------------
Bytes Format Units Label Explanations
--------------------------------------------------------------------------------
1- 4 I4 --- year Calendar year
5- 8 I4 --- month Month
9- 12 I4 --- day Day of month
13- 16 I4 --- hour Hour UTC
17- 26 F10.2 d MJD Modified Julian Date
27- 38 F12.6 arcsec PM_x Pole coordinate x
39- 50 F12.6 arcsec PM_y Pole coordinate y
51- 62 F12.7 s UT1_UTC Difference UT1-UTC
63- 74 F12.6 arcsec dX_2000A Pole offset dX wrt IAU2000A Nutation
75- 86 F12.6 arcsec dY_2000A Pole offset dY wrt IAU2000A Nutation
87- 98 F12.6 arcsec/d PM_x_dot Pole coordinate rate x
99-110 F12.6 arcsec/d PM_y_dot Pole coordinate rate y
111-122 F12.7 s LOD Length of day offset
123-134 F12.6 arcsec e_PM_x Error in PM_x
135-146 F12.6 arcsec e_PM_y Error in PM_y
147-158 F12.7 s e_UT1_UTC Error in UT1_UTC
159-170 F12.6 arcsec e_dX_2000A Error in dX_2000A
171-182 F12.6 arcsec e_dY_2000A Error in dY_2000A
183-194 F12.6 arcsec/d e_PM_x_dot Error in PM_x_dot
195-206 F12.6 arcsec/d e_PM_y_dot Error in PM_y_dot
207-218 F12.7 s e_LOD Error in LOD
--------------------------------------------------------------------------------
22,301 changes: 22,301 additions & 0 deletions astropy/utils/iers/data/eopc04.1962-now

Large diffs are not rendered by default.

22,295 changes: 0 additions & 22,295 deletions astropy/utils/iers/data/eopc04_IAU2000.62-now

This file was deleted.

6 changes: 3 additions & 3 deletions astropy/utils/iers/data/update_builtin_iers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ set -euv
# It downloads up-to-date versions of the earth rotation and leap
# second tables.

rm Leap_Second.dat
rm eopc04_IAU2000.62-now
rm -f Leap_Second.dat
rm -f eopc04.1962-now

# iers.IERS_B_URL
wget http://hpiers.obspm.fr/iers/eop/eopc04/eopc04_IAU2000.62-now
wget https://hpiers.obspm.fr/iers/eop/eopc04/eopc04.1962-now
# iers.IERS_LEAP_SECOND_URL
wget https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat
33 changes: 27 additions & 6 deletions astropy/utils/iers/iers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
IERS_A_README = get_pkg_data_filename("data/ReadMe.finals2000A")

# IERS-B default file name, URL, and ReadMe with content description
IERS_B_FILE = get_pkg_data_filename("data/eopc04_IAU2000.62-now")
IERS_B_URL = "http://hpiers.obspm.fr/iers/eop/eopc04/eopc04_IAU2000.62-now"
IERS_B_README = get_pkg_data_filename("data/ReadMe.eopc04_IAU2000")
IERS_B_FILE = get_pkg_data_filename("data/eopc04.1962-now")
IERS_B_URL = "https://hpiers.obspm.fr/iers/eop/eopc04/eopc04.1962-now"
IERS_B_README = get_pkg_data_filename("data/ReadMe.eopc04")

# LEAP SECONDS default file name, URL, and alternative format/URL
IERS_LEAP_SECOND_FILE = get_pkg_data_filename("data/Leap_Second.dat")
Expand Down Expand Up @@ -673,13 +673,16 @@ class IERS_B(IERS):
-----
If the package IERS B file (```iers.IERS_B_FILE``) is out of date, a new
version can be downloaded from ``iers.IERS_B_URL``.
See `~astropy.utils.iers.IERS_B.read` for instructions on how to read
a pre-2023 style IERS B file (usually named ``eopc04_IAU2000.62-now``).
"""

iers_table = None

@classmethod
def read(cls, file=None, readme=None, data_start=14):
"""Read IERS-B table from a eopc04_iau2000.* file provided by IERS.
def read(cls, file=None, readme=None, data_start=6):
"""Read IERS-B table from a eopc04.* file provided by IERS.
Parameters
----------
Expand All @@ -690,11 +693,29 @@ def read(cls, file=None, readme=None, data_start=14):
full path to ascii file holding CDS-style readme.
Defaults to package version, ``iers.IERS_B_README``.
data_start : int
starting row. Default is 14, appropriate for standard IERS files.
Starting row. Default is 6, appropriate for standard IERS files.
Returns
-------
``IERS_B`` class instance
Notes
-----
To read a pre-2023 style IERS B file (usually named something like
``eopc04_IAU2000.62-now``), do something like this example with an
excerpt that is used for testing::
>>> from astropy.utils.iers import IERS_B
>>> from astropy.utils.data import get_pkg_data_filename
>>> old_style_file = get_pkg_data_filename(
... "tests/data/iers_b_old_style_excerpt",
... package="astropy.utils.iers")
>>> iers_b = IERS_B.read(
... old_style_file,
... readme=get_pkg_data_filename("data/ReadMe.eopc04_IAU2000",
... package="astropy.utils.iers"),
... data_start=14)
"""
if file is None:
file = IERS_B_FILE
Expand Down
36 changes: 36 additions & 0 deletions astropy/utils/iers/tests/data/iers_b_old_style_excerpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
EARTH ORIENTATION PARAMETER (EOP) PRODUCT CENTER CENTER (PARIS OBSERVATORY)
INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE
EOP (IERS) 14 C04 TIME SERIES
Description: https://hpiers.obspm.fr/eoppc/eop/eopc04/C04.guide.pdf
contact: christian.bizouard@obspm.fr


FORMAT(3(I4),I7,2(F11.6),2(F12.7),2(F11.6),2(F11.6),2(F11.7),2(F12.6))
##################################################################################

Date MJD x y UT1-UTC LOD dX dY x Err y Err UT1-UTC Err LOD Err dX Err dY Err
" " s s " " " " s s " "
(0h UTC)

1962 1 1 37665 -0.012700 0.213000 0.0326338 0.0017230 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 2 37666 -0.015900 0.214100 0.0320547 0.0016690 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 3 37667 -0.019000 0.215200 0.0315526 0.0015820 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 4 37668 -0.021999 0.216301 0.0311435 0.0014960 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 5 37669 -0.024799 0.217301 0.0308154 0.0014160 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 6 37670 -0.027599 0.218301 0.0305353 0.0013820 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 7 37671 -0.030199 0.219301 0.0302682 0.0014130 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 8 37672 -0.032798 0.220202 0.0299280 0.0015050 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 9 37673 -0.035198 0.221102 0.0294869 0.0016280 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 10 37674 -0.037498 0.222002 0.0289268 0.0017380 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 11 37675 -0.039697 0.222803 0.0282797 0.0017940 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 12 37676 -0.041797 0.223703 0.0276136 0.0017740 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 13 37677 -0.043797 0.224503 0.0270075 0.0016670 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 14 37678 -0.045697 0.225203 0.0265403 0.0015100 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 15 37679 -0.047496 0.226004 0.0262572 0.0013120 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 16 37680 -0.049196 0.226704 0.0261751 0.0011120 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 17 37681 -0.050796 0.227404 0.0262740 0.0009360 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 18 37682 -0.052295 0.228005 0.0265299 0.0008110 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 19 37683 -0.053595 0.228705 0.0268868 0.0007330 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 20 37684 -0.054895 0.229305 0.0273077 0.0006810 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 21 37685 -0.055995 0.229905 0.0277506 0.0006780 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
1962 1 22 37686 -0.057094 0.230506 0.0281834 0.0007210 0.000000 0.000000 0.030000 0.030000 0.0020000 0.0014000 0.004774 0.002000
22 changes: 22 additions & 0 deletions astropy/utils/iers/tests/test_iers.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,28 @@ def test_open_network_url(self):
iers.IERS_A.close()


def test_IERS_B_old_style_excerpt():
"""Check that the instructions given in `IERS_B.read` actually work."""
# If this test is changed, be sure to also adjust the instructions.
#
# TODO: this test and the note can probably be removed after
# enough time has passed that old-style IERS_B files are simply
# not around any more, say in 2025. If so, also remove the excerpt
# and the ReadMe.eopc04_IAU2000 file.
old_style_file = get_pkg_data_filename(
os.path.join("data", "iers_b_old_style_excerpt")
)
excerpt = iers.IERS_B.read(
old_style_file,
readme=get_pkg_data_filename(
"data/ReadMe.eopc04_IAU2000", package="astropy.utils.iers"
),
data_start=14,
)
assert isinstance(excerpt, QTable)
assert "PM_x_dot" not in excerpt.colnames


class TestIERS_AExcerpt:
def test_simple(self):
# Test the IERS A reader. It is also a regression tests that ensures
Expand Down
3 changes: 3 additions & 0 deletions docs/changes/utils/14382.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Ensure we can read the newer ``IERS_B`` files produced by the International
Earth Rotation and Reference Systems Service, and point
``astropy.utils.iers.IERS_B_URL`` to the new location.

0 comments on commit 938dad8

Please sign in to comment.