Skip to content
Snippets Groups Projects
Commit 2f574471 authored by Hal Simpson's avatar Hal Simpson
Browse files

Added function to determine if an algorithm can produce data for the given timerange.

parent 31f42d5e
No related branches found
No related tags found
No related merge requests found
"""Algorithm Interface."""
import TimeseriesUtility
class Algorithm(object):
"""Base class for geomag algorithms
......@@ -67,3 +69,25 @@ class Algorithm(object):
start and end of required input to generate requested output.
"""
return (start, end)
def can_produce_data(self, starttime, endtime, stream):
"""Can Product data
Parameters
----------
starttime: UTCDateTime
start time of requested output
end : UTCDateTime
end time of requested output
stream: obspy.core.Stream
The input stream we want to make certain has data for the algorithm
"""
input_gaps = TimeseriesUtility.get_merged_gaps(
TimeseriesUtility.get_stream_gaps(stream))
for input_gap in input_gaps:
# Check for gaps that include the entire range
if (starttime >= input_gap[0] and
starttime <= input_gap[1] and
endtime < input_gap[2]):
return False
return True
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