Skip to content

Commit 09c02a6

Browse files
committed
Patch IERS-B values directly into IERS-A table [skip ci]
1 parent 47021e9 commit 09c02a6

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎astropy/utils/iers/iers.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,23 @@ def _combine_a_b_columns(iers_a):
367367
table = iers_a[~iers_a['UT1_UTC_A'].mask &
368368
~iers_a['PolPMFlag_A'].mask]
369369

370+
# IERS-A has IERS-B values included, but for reasons unknown these do not
371+
# match the latest IERS-B values. See comments in #4436 for details. So
372+
# here we use the bundled astropy IERS-B table to overwrite the values
373+
# in the downloaded IERS-A table.
374+
iers_b = IERS_B.open()
375+
# IERS-B starts before IERS-A (the finals2000A.all version) so fix that.
376+
i0 = np.searchsorted(iers_b['MJD'].value, table['MJD'][0])
377+
iers_b = iers_b[i0:]
378+
n_iers_b = len(iers_b)
379+
# Sanity check that we are overwriting the correct values
380+
if not np.allclose(table['MJD'][:n_iers_b], iers_b['MJD'].value):
381+
raise ValueError('unexpected mismatch when copying IERS-B values into IERS-A table')
382+
# Finally do the overwrite
383+
table['UT1_UTC_B'][:n_iers_b] = iers_b['UT1_UTC'].value
384+
table['PM_X_B'][:n_iers_b] = iers_b['PM_x'].value
385+
table['PM_Y_B'][:n_iers_b] = iers_b['PM_y'].value
386+
370387
# Run np.where on the data from the table columns, since in numpy 1.9
371388
# it otherwise returns an only partially initialized column.
372389
table['UT1_UTC'] = np.where(table['UT1_UTC_B'].mask,

0 commit comments

Comments
 (0)