Skip to content
Snippets Groups Projects
Commit 3e163b43 authored by arigdon-usgs's avatar arigdon-usgs
Browse files

Changed counter to a boolean first to be more explicit

parent 10e8d5ba
No related branches found
No related tags found
No related merge requests found
......@@ -57,26 +57,24 @@ class AverageAlgorithm(Algorithm):
'Only 1 channel may be averaged at one time'
% (len(self.observatories), len(timeseries)))
count = 1
first = True
# 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 count == 1:
if first:
self._stats = ts.stats
if count == 1:
self._npts = ts.stats.npts
selt._stt = ts.stats.starttime
first = False
if ts.stats.npts != self._npts:
raise AlgorithmException(
'Received timeseries have different lengths')
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
......
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