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

DM-29059: Be more defensive in calculating time of observation #294

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions python/lsst/obs/lsst/translators/lsst.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,12 @@ def to_location(self):
@cache_translation
def to_datetime_begin(self):
# Docstring will be inherited. Property defined in properties.py
self._used_these_cards("MJD-OBS")
return Time(self._header["MJD-OBS"], scale="tai", format="mjd")
# We prefer to use MJD-OBS but it seems that this can be missing
# and so we fall back to DATE-OBS
if self.is_key_ok("MJD-OBS"):
self._used_these_cards("MJD-OBS")
return Time(self._header["MJD-OBS"], scale="tai", format="mjd")
return super().to_datetime_begin()

@cache_translation
def to_datetime_end(self):
Expand Down