Skip to content
Snippets Groups Projects
Commit 9b90db58 authored by Cain, Payton David's avatar Cain, Payton David Committed by Jeremy M Fee
Browse files

Check starttime before filter operation

parent d10afca8
No related branches found
No related tags found
No related merge requests found
...@@ -188,13 +188,14 @@ class FilterAlgorithm(Algorithm): ...@@ -188,13 +188,14 @@ class FilterAlgorithm(Algorithm):
out = Stream() out = Stream()
for trace in stream: for trace in stream:
filtered = self.firfilter(trace.data, window, decimation)
stats = Stats(trace.stats) stats = Stats(trace.stats)
stats.starttime = stats.starttime + input_sample_period * (numtaps // 2) filtered_starttime = stats.starttime + input_sample_period * (numtaps // 2)
if stats.starttime.timestamp % output_sample_period != 0: if filtered_starttime.timestamp % output_sample_period != 0:
raise ValueError( raise ValueError(
"Invalid starttime. Filter is not centered in timeseries." "Invalid starttime. Filter is not centered in timeseries."
) )
filtered = self.firfilter(trace.data, window, decimation)
stats.starttime = filtered_starttime
stats.delta = output_sample_period stats.delta = output_sample_period
stats.npts = len(filtered) stats.npts = len(filtered)
trace_out = self.create_trace(stats.channel, stats, filtered) trace_out = self.create_trace(stats.channel, stats, filtered)
......
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