diff --git a/eispac/core/eismap.py b/eispac/core/eismap.py index c146b37..e8e9cf5 100644 --- a/eispac/core/eismap.py +++ b/eispac/core/eismap.py @@ -126,13 +126,20 @@ def date_average(self): return self._get_date('date_avg') or super().date_average @property - def date(self): - # NOTE: we override this property to prioritize date_average - # over DATE-OBS (or DATE_OBS). In GenericMap, this is reversed. - # We do this because we want to make sure we are constructing our - # coordinate frames from DATE_AVG (the midpoint of the raster) and - # not DATE-OBS which is the beginning of the raster. - return self.date_average or super().date + def reference_date(self): + """ + The reference date for the coordinate system + + According to Section 2.4 of + `EIS Software Note 9 `_, + the pointing keywords are defined at the start of the raster. As such, this property returns the + time at the beginning of the raster. + + .. note:: This property is overridden because `sunpy.map.GenericMap` sets + this to be the ``.date_average`` which in this case is the midpoint + of the raster. + """ + return self.date_start @classmethod def is_datasource_for(cls, data, header, **kwargs): diff --git a/eispac/tests/test_eismap.py b/eispac/tests/test_eismap.py index 574b26f..b41f2bb 100644 --- a/eispac/tests/test_eismap.py +++ b/eispac/tests/test_eismap.py @@ -1,7 +1,6 @@ """ Tests for `eispac.EISMap` """ -import copy from textwrap import dedent import numpy as np @@ -104,30 +103,19 @@ def test_date_props(test_eis_map, attr, key): assert getattr(test_eis_map, attr).isot == test_eis_map.meta[key] -def test_date(test_eis_map, test_header): - # Case 1: date-average exists - assert test_eis_map.date.isot == test_eis_map.meta['date_avg'] - # Case 2: date-average is None so default to date_obs - header = copy.deepcopy(test_header) - del header['date_beg'] - del header['date_end'] - del header['date_avg'] - new_map = sunpy.map.Map(test_eis_map.data, header) - assert new_map.date.isot == new_map.meta['date_obs'] - # Case 3: date_avg is None so default to date_start - header = copy.deepcopy(test_header) - del header['date_avg'] - del header['date_end'] - del header['date_obs'] - new_map = sunpy.map.Map(test_eis_map.data, header) - assert new_map.date.isot == new_map.meta['date_beg'] - # Case 4: date_end and date_avg do not exist - header = copy.deepcopy(test_header) - del header['date_avg'] - del header['date_beg'] - del header['date_obs'] - new_map = sunpy.map.Map(test_eis_map.data, header) - assert new_map.date.isot == new_map.meta['date_end'] +def test_date_is_dateobs(test_eis_map): + "Test that .date returns DATE_OBS" + assert test_eis_map.date.isot == test_eis_map.meta['date_obs'] + + +def test_date_is_date_start(test_eis_map): + "Test that .date returns the same date as .date_start" + assert test_eis_map.date == test_eis_map.date_start + + +def test_reference_date_is_date_start(test_eis_map): + "Test that the reference date is the time at the beginning of the raster" + assert test_eis_map.reference_date == test_eis_map.date_start def test_plot_settings(test_eis_map):