diff --git a/geomagio/algorithm/AverageAlgorithm.py b/geomagio/algorithm/AverageAlgorithm.py index 692ff5c8f01fdc59f4cb5943f83e2ba753d0b390..fe970d63d67828576589416913e242a17db5a0ac 100644 --- a/geomagio/algorithm/AverageAlgorithm.py +++ b/geomagio/algorithm/AverageAlgorithm.py @@ -6,6 +6,7 @@ from __future__ import absolute_import from .Algorithm import Algorithm from .AlgorithmException import AlgorithmException from ..ObservatoryMetadata import ObservatoryMetadata +from .. import TimeseriesUtility import numpy import obspy.core @@ -65,6 +66,24 @@ class AverageAlgorithm(Algorithm): self.min_count_end = min_count_end 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): """checks a stream to make certain the required data exists.