diff --git a/gridded_glm/libexec/_minute_gridder.py b/gridded_glm/libexec/_minute_gridder.py index 94301596b088a5d411a03e0279f6e64f5f0f2e94..4b4709055d40849f64fd8912291a63c1358f2aab 100644 --- a/gridded_glm/libexec/_minute_gridder.py +++ b/gridded_glm/libexec/_minute_gridder.py @@ -5,7 +5,7 @@ parse_desc = """Grid the past X minutes of GLM flash data, given a single input """ import numpy as np -from datetime import datetime +from datetime import datetime, timedelta import os import sys import tempfile @@ -111,7 +111,16 @@ def get_start_end(filenames, start_time=None, end_time=None): filename_starts = [info[3] for info in filename_infos] filename_ends = [info[4] for info in filename_infos] start_time = min(filename_starts) - end_time = max(filename_ends) + + # Used to use max(filename_ends), but on 27 Oct 2020, the filename + # ends started to report the time of the last event in the file, + # causing a slight leakage (usually less than a second) into the + # next minute. This caused two minutes of grids to be produced for every + # three twenty second files passed to this script. + # Instead, we now assume every LCFA file is 20 s long, beginning with + # the start time. No doubt in the future we will see filenames that no + # longer start on an even minute boundary. + end_time = max(filename_starts) + timedelta(0, 20) if start_time is None or end_time is None: raise ValueError("Could not determine start/end time")