Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,25 @@ def set_increment_times(self) -> None:
execution. The determined times are stored in ``increment_start`` and
``increment_finish``.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that this method only calls the three phases, the docstring could describe them instead of "the coverage of a given SPK or CK kernel". For example: the initial times come from the meta-kernels, then the configuration, then the mission times; they are widened with the previous bundle's interval; and they are converted to the configured date format.

"""
(increment_start, increment_finish) = self._initial_increment_times()

(increment_start, increment_finish) = self._correct_from_previous_bundle(
increment_start, increment_finish)

(increment_start, increment_finish) = self._normalise_increment_times(
increment_start, increment_finish)

self.increment_finish = increment_finish
self.increment_start = increment_start

def _initial_increment_times(self) -> tuple[str, str]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method, and the other two added in this PR, do not have :return: lines (or :param:, where applicable). Please add the input and output documentation to the docstrings.

"""Pick the first increment start and finish times.

They come from the meta-kernels that set the coverage, then from the
configuration, and finally from the mission start and finish times.
If the meta-kernels fail halfway, a start already taken from them is
kept while the finish falls back.
"""
increment_start = ""
increment_finish = ""
#
Expand Down Expand Up @@ -295,6 +314,17 @@ def set_increment_times(self) -> None:
'Mission stop time will be used:')
logging.warning(' %s', increment_finish)

return increment_start, increment_finish

def _correct_from_previous_bundle(
self, increment_start: str, increment_finish: str
) -> tuple[str, str]:
"""Widen the increment times with the previous bundle's interval.

When the previous label is missing, unreadable or lacks a start or
stop tag, a warning is logged and the times are returned as they
are at that point, so a start corrected before the failure is kept.
"""
#
# We check the coverage with the previous increment.
#
Expand Down Expand Up @@ -353,6 +383,16 @@ def set_increment_times(self) -> None:
except (IndexError, TypeError, *FILE_READ_ERRORS):
logging.warning("-- Previous bundle not found.")

return increment_start, increment_finish

def _normalise_increment_times(
self, increment_start: str, increment_finish: str
) -> tuple[str, str]:
"""Convert the increment times to the configured date format.

Without a loaded LSK the times are returned as they came in. The
resulting interval is logged either way.
"""
#
# Check the format of the previous bundle and correct it. The 'Z' is
# removed from the UTC string since it is not supported until the
Expand All @@ -376,8 +416,7 @@ def set_increment_times(self) -> None:
logging.info(' %s - %s', increment_start, increment_finish)
logging.info('')

self.increment_finish = increment_finish
self.increment_start = increment_start
return increment_start, increment_finish

def validate(self) -> None:
"""Validate the SPICE Kernels collection.
Expand Down
Loading
Loading