From 0dcdead5c2a87373586a1036a8c33b6de6075dfa Mon Sep 17 00:00:00 2001
From: "E. Joshua Rigler" <erigler@usgs.gov>
Date: Mon, 14 Nov 2022 12:57:00 -0700
Subject: [PATCH] Use self.observatories to determine number of inputs

Previously use the number of traces in the input Stream. This could
be fewer than the number of desired observatories if a given input's
data was completely missing.
---
 geomagio/algorithm/AverageAlgorithm.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/geomagio/algorithm/AverageAlgorithm.py b/geomagio/algorithm/AverageAlgorithm.py
index 3a087918..1787ad19 100644
--- a/geomagio/algorithm/AverageAlgorithm.py
+++ b/geomagio/algorithm/AverageAlgorithm.py
@@ -122,7 +122,7 @@ class AverageAlgorithm(Algorithm):
 
         self.outlocation = self.outlocation or timeseries[0].stats.location
 
-        self.min_count = self.min_count or len(timeseries)
+        self.min_count = self.min_count or len(self.observatories)
         self.min_count_start = self.min_count_start or timeseries[0].stats.starttime
         self.min_count_end = self.min_count_end or timeseries[0].stats.endtime
 
-- 
GitLab