Skip to content

Commit

Permalink
Fix .date for EUI maps
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby committed Jul 16, 2021
1 parent d212f58 commit f980740
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/5462.bugfix.rst
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 7 additions & 0 deletions sunpy/map/sources/solo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down Expand Up @@ -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'),
Expand Down
4 changes: 3 additions & 1 deletion sunpy/map/sources/tests/test_eui_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit f980740

Please sign in to comment.