Skip to content
Snippets Groups Projects
Commit 2ee9fb26 authored by Nick Bearson's avatar Nick Bearson
Browse files

fix the two-files-per-minute issue. follows Eric's fix to the example make_GLM_grids.py script:

https://github.com/deeplycloudy/glmtools/commit/caa7d5af4a27060c56258c9bf73fa6a13891b0e1
parent 473f00e1
No related branches found
No related tags found
1 merge request!4add satpy to our buildbucket
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment