From f53cd3560487ccf9d9823c6e7f588e972d698e92 Mon Sep 17 00:00:00 2001 From: Rigdon <arigdon@igskcicgvmmage1.cr.usgs.gov> Date: Fri, 15 Jun 2018 14:30:13 +0000 Subject: [PATCH] Average Algorithm counter for run as update usage --- geomagio/algorithm/AverageAlgorithm.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/geomagio/algorithm/AverageAlgorithm.py b/geomagio/algorithm/AverageAlgorithm.py index dc11161a7..ca35637ac 100644 --- a/geomagio/algorithm/AverageAlgorithm.py +++ b/geomagio/algorithm/AverageAlgorithm.py @@ -57,25 +57,26 @@ class AverageAlgorithm(Algorithm): 'Only 1 channel may be averaged at one time' % (len(self.observatories), len(timeseries))) + count = 1 # timeseries starttime and number of samples must match for ts in timeseries: # grab 1st set of stats to use in output. # Its values will be good if checks pass. - if self._stats is None: + if count == 1: self._stats = ts.stats - if self._npts == -1: + if count == 1: self._npts = ts.stats.npts if ts.stats.npts != self._npts: raise AlgorithmException( 'Received timeseries have different lengths') - if self._stt == -1: + if count == 1: self._stt = ts.stats.starttime if ts.stats.starttime != self._stt: raise AlgorithmException( 'Received timeseries have different starttimes') - + count+=1 def process(self, timeseries): """averages a channel across multiple stations -- GitLab