Skip to content
Snippets Groups Projects
Commit c072fde5 authored by Cain, Payton David's avatar Cain, Payton David
Browse files

remove call for shift, move shift method below get nearest time

parent b7164e8f
No related branches found
No related tags found
2 merge requests!146Release CMO metadata to production,!17Implement hourly/daily filtering products
...@@ -43,24 +43,6 @@ STEPS = [ ...@@ -43,24 +43,6 @@ STEPS = [
] ]
def get_step_time_shift(step):
"""Calculates the time shift generated in each filtering step
Parameters
----------
step: dict
Dictionary object holding information about a given filter step
Returns
-------
shift: float
Time shift value
"""
input_sample_period = step["input_sample_period"]
numtaps = len(step["window"])
shift = input_sample_period * ((numtaps - 1) / 2)
return shift
def get_nearest_time(step, output_time, left=True): def get_nearest_time(step, output_time, left=True):
interval_start = output_time - ( interval_start = output_time - (
output_time.timestamp % step["output_sample_period"] output_time.timestamp % step["output_sample_period"]
...@@ -87,6 +69,24 @@ def get_nearest_time(step, output_time, left=True): ...@@ -87,6 +69,24 @@ def get_nearest_time(step, output_time, left=True):
} }
def get_step_time_shift(step):
"""Calculates the time shift generated in each filtering step
Parameters
----------
step: dict
Dictionary object holding information about a given filter step
Returns
-------
shift: float
Time shift value
"""
input_sample_period = step["input_sample_period"]
numtaps = len(step["window"])
shift = input_sample_period * ((numtaps - 1) / 2)
return shift
class FilterAlgorithm(Algorithm): class FilterAlgorithm(Algorithm):
""" """
Filter Algorithm that filters and downsamples data Filter Algorithm that filters and downsamples data
...@@ -257,9 +257,6 @@ class FilterAlgorithm(Algorithm): ...@@ -257,9 +257,6 @@ class FilterAlgorithm(Algorithm):
decimation = int(output_sample_period / input_sample_period) decimation = int(output_sample_period / input_sample_period)
numtaps = len(window) numtaps = len(window)
window = window / sum(window) window = window / sum(window)
# first output timestamp is in the center of the filter window for firfilters
# center output timestamp is in the center of the filter window for averages
shift = get_step_time_shift(step)
out = Stream() out = Stream()
for trace in stream: for trace in stream:
starttime, data = self.align_trace(step, trace) starttime, data = self.align_trace(step, trace)
......
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