From 9da1d203ee57f5372df930864a905785fabf0e60 Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Tue, 29 Aug 2023 08:35:32 -0600 Subject: [PATCH] docstring, in retrieve_gaps_from_stream_header()'s loop, continue when gap_minimum is None --- sohstationviewer/model/reftek_data/reftek_helper.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sohstationviewer/model/reftek_data/reftek_helper.py b/sohstationviewer/model/reftek_data/reftek_helper.py index fc467b112..ca29e9cbe 100644 --- a/sohstationviewer/model/reftek_data/reftek_helper.py +++ b/sohstationviewer/model/reftek_data/reftek_helper.py @@ -163,7 +163,7 @@ def retrieve_gaps_from_stream_header( gaps_by_key_chan: Dict[Union[str, Tuple[str, str]], Dict[str, List[List[int]]]], gaps: Dict[str, List[List[float]]], - gap_minimum, + gap_minimum: Optional[float], read_start: Optional[float], read_end: Optional[float]) -> Dict[str, List[List[float]]]: """ @@ -173,10 +173,15 @@ def retrieve_gaps_from_stream_header( :param streams: dict of stream header by sta, chan :param gaps_by_key_chan: gaps list by key and channel id :param gaps: gaps list by key + :param gap_minimum: minimum length of gaps to be detected + :param read_start: start time of data to be read + :param read_end: end time of data to be read """ for sta_id in streams: sta_gaps = [] gaps_by_key_chan[sta_id] = {} + if gap_minimum is None: + continue for chan_id in streams[sta_id]: stream = streams[sta_id][chan_id] gaps_in_stream = stream.get_gaps() @@ -188,7 +193,8 @@ def retrieve_gaps_from_stream_header( gaps[sta_id] = squash_gaps(sta_gaps) -def _check_gap(t1, t2, start, end, gap_minimum): +def _check_gap(t1: float, t2: float, start: float, end: float, + gap_minimum: float) -> bool: """ Check if a part of the given gap in the given time range and the gap is greater than gap_minimum @@ -196,7 +202,7 @@ def _check_gap(t1, t2, start, end, gap_minimum): :param t2: end of given gap :param start: start of time range :param end: end of given time range - :param gap_minimum: + :param gap_minimum: minimum length of gaps to be detected :return: True if check is satisfied, False otherwise """ t1 = t1.timestamp -- GitLab