desihub / desisurvey

Code for desi survey planning and implementation
BSD 3-Clause "New" or "Revised" License
2 stars 7 forks source link

reading horizons_2020_week1_moon.csv broken under astropy 4.2 #137

Closed sbailey closed 3 years ago

sbailey commented 3 years ago

This code used in test_ephem.py and test_utils.py is broken under astropy 4.2 because the last column is no longer parsed as name "col10":

        # Configure a CSV reader for the Horizons output format.
        csv_reader = astropy.io.ascii.Csv()
        csv_reader.header.comment = r'[^ ]'
        csv_reader.data.start_line = 35
        csv_reader.data.end_line = 203
        # Read moon ephemerides for the first week of 2020.
        path = astropy.utils.data._find_pkg_data_path(
            os.path.join('data', 'horizons_2020_week1_moon.csv'),
            package='desisurvey')
        cls.table = csv_reader.read(path)
        # Horizons CSV file has a trailing comma on each line.
        cls.table.remove_column('col10')

I suggest moving this horizons_2020_week1_moon.csv reader into a single place that both test_ephem.py and test_utils.py can use, ensuring that it works with both astropy 4.0.x and 4.2.x, and switch from using astropy.utils.data._find_pkg_data_path to pkg_resources.resource_filename to avoid using a _underscore_hidden function from astropy that may break again in a future release.