Skip to content
Snippets Groups Projects
Commit 134c3a1c authored by Erin (Josh) Rigler's avatar Erin (Josh) Rigler
Browse files

Merge branch 'override_can_produce_data_AverageAlgorithm' into 'master'

Make AverageAlgorithm require **any** inputs

See merge request !198
parents 2ce70a51 c24e2e9c
No related branches found
No related tags found
1 merge request!198Make AverageAlgorithm require **any** inputs
Pipeline #197799 passed
...@@ -205,7 +205,10 @@ def get_stream_gaps(stream, channels=None): ...@@ -205,7 +205,10 @@ def get_stream_gaps(stream, channels=None):
channel = trace.stats.channel channel = trace.stats.channel
if channels is not None and channel not in channels: if channels is not None and channel not in channels:
continue continue
gaps[channel] = get_trace_gaps(trace) if channel in gaps:
gaps[channel].extend(get_trace_gaps(trace))
else:
gaps[channel] = get_trace_gaps(trace)
return gaps return gaps
......
...@@ -6,6 +6,7 @@ from __future__ import absolute_import ...@@ -6,6 +6,7 @@ from __future__ import absolute_import
from .Algorithm import Algorithm from .Algorithm import Algorithm
from .AlgorithmException import AlgorithmException from .AlgorithmException import AlgorithmException
from ..ObservatoryMetadata import ObservatoryMetadata from ..ObservatoryMetadata import ObservatoryMetadata
from .. import TimeseriesUtility
import numpy import numpy
import obspy.core import obspy.core
...@@ -65,6 +66,24 @@ class AverageAlgorithm(Algorithm): ...@@ -65,6 +66,24 @@ class AverageAlgorithm(Algorithm):
self.min_count_end = min_count_end self.min_count_end = min_count_end
self.observatoryMetadata = ObservatoryMetadata() self.observatoryMetadata = ObservatoryMetadata()
def can_produce_data(self, starttime, endtime, stream):
"""Can Produce data
By default require all channels to have data at the same time.
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
"""
return TimeseriesUtility.has_any_channels(
stream, self.get_required_channels(), starttime, endtime
)
def check_stream(self, timeseries): def check_stream(self, timeseries):
"""checks a stream to make certain the required data """checks a stream to make certain the required data
exists. exists.
......
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