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

Make AverageAlgorithm require **any** inputs

Recent attempts to change the AverageAlgorithm to allow fewer than the full
complement of inputs when calculating a mutli-station average were thwarted
by the default can_produce_data() method in the parent Algorithm class, which
required all inputs to be present, when what we now want is **any** inputs to
be present.
parent 2ce70a51
No related branches found
No related tags found
1 merge request!198Make AverageAlgorithm require **any** inputs
...@@ -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