@@ -598,6 +598,49 @@ def pm_source(self, i):
598598 """Set PM source flag for entries in IERS table"""
599599 return np .ones_like (i ) * FROM_IERS_B
600600
601+ @classmethod
602+ def _create_a_columns (cls , table ):
603+ """
604+ Return a new table with appropriate combination of IERS_A and B columns.
605+ """
606+ # UT1_UTC present in IERS B already
607+ table ['UT1_UTC_B' ] = table ['UT1_UTC' ].data
608+ table ['UT1_UTC_B' ].unit = table ['UT1_UTC' ].unit
609+ table ['UT1Flag' ] = 'B'
610+
611+ # Repeat for polar motions.
612+ table ['PM_X' ] = table ['PM_x' ].data
613+ table ['PM_X' ].unit = table ['PM_x' ].unit
614+ table ['PM_Y' ] = table ['PM_y' ].data
615+ table ['PM_Y' ].unit = table ['PM_y' ].unit
616+ table ['PM_X_B' ] = table ['PM_x' ].data
617+ table ['PM_X_B' ].unit = table ['PM_x' ].unit
618+ table ['PM_Y_B' ] = table ['PM_y' ].data
619+ table ['PM_Y_B' ].unit = table ['PM_y' ].unit
620+ table ['PolPMFlag' ] = 'B'
621+
622+ # IERS A uses marcsec but IERS B uses arcsec for these
623+ # Convert in case someone does a plain .value
624+ table ['dX_2000A_B' ] = table ['dX_2000A' ].to (u .marcsec ).data
625+ table ['dX_2000A_B' ].unit = table ['dX_2000A' ].to (u .marcsec ).unit
626+
627+ table ['dY_2000A_B' ] = table ['dY_2000A' ].to (u .marcsec ).data
628+ table ['dY_2000A_B' ].unit = table ['dY_2000A' ].to (u .marcsec ).unit
629+
630+ table ['NutFlag' ] = 'B'
631+
632+ # No predictions in B
633+ # Get the table index for the first row that has predictive values
634+ # PolPMFlag_A IERS (I) or Prediction (P) flag for
635+ # Bull. A polar motion values
636+ # UT1Flag_A IERS (I) or Prediction (P) flag for
637+ # Bull. A UT1-UTC values
638+ #is_predictive = (table['UT1Flag_A'] == 'P') | (table['PolPMFlag_A'] == 'P')
639+ #table.meta['predictive_index'] = np.min(np.flatnonzero(is_predictive))
640+ #table.meta['predictive_mjd'] = table['MJD'][table.meta['predictive_index']]
641+
642+ return table
643+
601644
602645class IERS_Auto (IERS_A ):
603646 """
@@ -629,7 +672,7 @@ def open(cls):
629672
630673 """
631674 if not conf .auto_download :
632- cls .iers_table = IERS_B .open ()
675+ cls .iers_table = IERS_B ._create_a_columns ( IERS . open () )
633676 return cls .iers_table
634677
635678 all_urls = (conf .iers_auto_url , conf .iers_auto_url_mirror )
@@ -661,7 +704,7 @@ def open(cls):
661704 warn (AstropyWarning ('failed to download {}, using local IERS-B: {}'
662705 .format (' and ' .join (all_urls ),
663706 ';' .join (err_list )))) # noqa
664- cls .iers_table = IERS_B .open ()
707+ cls .iers_table = IERS_B ._create_a_columns ( IERS . open () )
665708 return cls .iers_table
666709
667710 cls .iers_table = cls .read (file = filename )
0 commit comments