From aae8838fc34c77335fbb559a973a3ee2bd4965f5 Mon Sep 17 00:00:00 2001
From: arigdon-usgs <arigdon@usgs.gov>
Date: Thu, 19 Jul 2018 11:15:47 -0600
Subject: [PATCH] Added channel options to can_produce_data and get_stream_gaps
 so get_required_channels can be used for XYZAlgorithm functionality

---
 geomagio/Controller.py          | 4 +++-
 geomagio/algorithm/Algorithm.py | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/geomagio/Controller.py b/geomagio/Controller.py
index 346070be5..d6b0d79ad 100644
--- a/geomagio/Controller.py
+++ b/geomagio/Controller.py
@@ -245,7 +245,9 @@ class Controller(object):
             if not algorithm.can_produce_data(
                     starttime=output_gap[0],
                     endtime=output_gap[1],
-                    stream=input_timeseries):
+                    stream=input_timeseries,
+                    channels = algorithm.get_required_channels() or \
+                        input_channels):
                 continue
             # check for fillable gap at start
             if output_gap[0] == options.starttime:
diff --git a/geomagio/algorithm/Algorithm.py b/geomagio/algorithm/Algorithm.py
index a3f264cb5..a712b14a1 100644
--- a/geomagio/algorithm/Algorithm.py
+++ b/geomagio/algorithm/Algorithm.py
@@ -87,7 +87,7 @@ class Algorithm(object):
         """
         return (start, end)
 
-    def can_produce_data(self, starttime, endtime, stream):
+    def can_produce_data(self, starttime, endtime, stream, channels = None):
         """Can Product data
 
         Parameters
@@ -100,7 +100,7 @@ class Algorithm(object):
             The input stream we want to make certain has data for the algorithm
         """
         input_gaps = TimeseriesUtility.get_merged_gaps(
-                TimeseriesUtility.get_stream_gaps(stream))
+                TimeseriesUtility.get_stream_gaps(stream,channels))
         for input_gap in input_gaps:
             # Check for gaps that include the entire range
             if (starttime >= input_gap[0] and
-- 
GitLab