From 90412d9fb6012867dd52cc7c46da2b9d13180406 Mon Sep 17 00:00:00 2001 From: Will Barnes Date: Mon, 23 Sep 2024 13:45:02 -0400 Subject: [PATCH] assume existence of t_obs key --- aiapy/calibrate/meta.py | 12 +++--------- aiapy/calibrate/tests/test_meta.py | 9 --------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/aiapy/calibrate/meta.py b/aiapy/calibrate/meta.py index c5f5965..487b4c8 100644 --- a/aiapy/calibrate/meta.py +++ b/aiapy/calibrate/meta.py @@ -123,16 +123,10 @@ def update_pointing(smap, *, pointing_table=None): # NOTE: For SDO data, T_OBS is preferred to DATE-OBS in the case of the # MPT, using DATE-OBS from near the slot boundary might result in selecting # an incorrect MPT record. + # FIXME: Beginning in sunpy v6.0.0, AIA maps use T_OBS as the reference date + # As such, once that is the min version supported, the following lines should + # be adjusted to just use smap.reference_date t_obs = smap.meta.get("T_OBS") - if t_obs is None: - warnings.warn( - "T_OBS key is missing from metadata. Falling back to Map.date. " - "This may result in selecting in incorrect record from the " - "master pointing table.", - AiapyUserWarning, - stacklevel=3, - ) - t_obs = smap.date t_obs = astropy.time.Time(t_obs) t_obs_in_interval = np.logical_and(t_obs >= pointing_table["T_START"], t_obs < pointing_table["T_STOP"]) if not t_obs_in_interval.any(): diff --git a/aiapy/calibrate/tests/test_meta.py b/aiapy/calibrate/tests/test_meta.py index 422b08e..183e1b9 100644 --- a/aiapy/calibrate/tests/test_meta.py +++ b/aiapy/calibrate/tests/test_meta.py @@ -86,15 +86,6 @@ def test_update_pointing_accuracy(aia_171_map, pointing_table, t_delt_factor, ex assert aia_map_updated.reference_pixel.y == pointing_table[expected_entry]["A_171_Y0"] -@pytest.mark.skip() # Because sunpy pulls reference_date from T_OBS, this test will always fail. Maybe remove? -@pytest.mark.remote_data() -def test_update_pointing_missing_tobs_raises_warning(aia_171_map, pointing_table): - # Tests that a warning is raised if T_OBS is not present. - aia_171_map.meta.pop("T_OBS") - with pytest.warns(AiapyUserWarning, match="T_OBS key is missing from metadata."): - update_pointing(aia_171_map, pointing_table=pointing_table) - - @pytest.mark.remote_data() def test_update_pointing_submap_raises_exception(aia_171_map, pointing_table): m = aia_171_map.submap(