Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 3.1] Return date-obs as date if it is present in HMISynopticMap #5649

Merged
merged 3 commits into from Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog/5648.bugfix.rst
@@ -0,0 +1,2 @@
Fixed a bug where the ``date`` property on `~sunpy.map.sources.HMISynopticMap` returned ``None``
if the ``DATE-OBS`` key was present.
2 changes: 2 additions & 0 deletions sunpy/map/sources/sdo.py
Expand Up @@ -186,6 +186,8 @@ def date(self):
date = self._get_date('DATE-OBS')
if date is None:
return self._get_date('T_OBS')
else:
return date

@property
def unit(self):
Expand Down
6 changes: 6 additions & 0 deletions sunpy/map/sources/tests/test_hmi_synoptic_source.py
Expand Up @@ -128,6 +128,12 @@ def test_date(hmi_synoptic):
hmi_synoptic.date


def test_date_uses_date_obs(hmi_synoptic):
"""Check that the date uses the date-obs key as well."""
hmi_synoptic.meta['date-obs'] = hmi_synoptic.meta.pop('t_obs')
assert hmi_synoptic.date is not None


def test_unit(hmi_synoptic):
# Check that the default unit of Mx/cm**2 is correctly replaced with a
# FITS standard unit
Expand Down