From f9807401933263de4d8b9c8ea11683a3e1b04568 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 16 Jul 2021 19:21:55 +0100 Subject: [PATCH] Fix .date for EUI maps --- changelog/5462.bugfix.rst | 5 +++++ sunpy/map/sources/solo.py | 7 +++++++ sunpy/map/sources/tests/test_eui_source.py | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 changelog/5462.bugfix.rst diff --git a/changelog/5462.bugfix.rst b/changelog/5462.bugfix.rst new file mode 100644 index 00000000000..f3b5c585967 --- /dev/null +++ b/changelog/5462.bugfix.rst @@ -0,0 +1,5 @@ +The date returned by `~sunpy.map.GenericMap.date` for Solar Orbiter/EUI maps +has been adjusted to be taken from the DATE-AVG keyword +(the middle of the image acquisition period), instead of the DATE-OBS +keyword (the beginning of the image acquisition period). This means the observer +coordinate now has the correct date. diff --git a/sunpy/map/sources/solo.py b/sunpy/map/sources/solo.py index f022f63b8a5..021ea0f8a05 100644 --- a/sunpy/map/sources/solo.py +++ b/sunpy/map/sources/solo.py @@ -8,6 +8,7 @@ from sunpy.coordinates import HeliocentricInertial from sunpy.map import GenericMap from sunpy.map.sources.source_type import source_stretch +from sunpy.time import parse_time __all__ = ['EUIMap'] @@ -47,6 +48,12 @@ def processing_level(self): def exposure_time(self): return self.meta.get('xposure', 0.0) * self.timeunit + @property + def date(self): + t = self.meta.get('date-avg') + timesys = self.meta.get('timesys') + return parse_time(t, scale=timesys.lower()) + @property def _supported_observer_coordinates(self): return [(('hcix_obs', 'hciy_obs', 'hciz_obs'), diff --git a/sunpy/map/sources/tests/test_eui_source.py b/sunpy/map/sources/tests/test_eui_source.py index c106b07dc73..2f4bc4c5594 100644 --- a/sunpy/map/sources/tests/test_eui_source.py +++ b/sunpy/map/sources/tests/test_eui_source.py @@ -242,7 +242,9 @@ def test_is_datasource_for(eui_fsi_map): def test_observer_coordinate(eui_fsi_map): - assert isinstance(eui_fsi_map.observer_coordinate, SkyCoord) + obs_coord = eui_fsi_map.observer_coordinate + assert isinstance(obs_coord, SkyCoord) + assert obs_coord.obstime.isot == eui_fsi_map.meta['date-avg'] def test_observatory(eui_fsi_map):