From 5a86220f7367a969409d9fb99c2562ea30aa45c5 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Thu, 15 Oct 2020 14:47:18 -0600 Subject: [PATCH] Add elements in steps for product stream information --- geomagio/algorithm/FilterAlgorithm.py | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/geomagio/algorithm/FilterAlgorithm.py b/geomagio/algorithm/FilterAlgorithm.py index 49353c0cd..84b0f9234 100644 --- a/geomagio/algorithm/FilterAlgorithm.py +++ b/geomagio/algorithm/FilterAlgorithm.py @@ -14,31 +14,51 @@ from .. import TimeseriesUtility STEPS = [ { # 10 Hz to one second filter "name": "10Hz", + "data_interval": "second", + "data_interval_type": "Average 1-Second", "input_sample_period": 0.1, "output_sample_period": 1.0, "window": sps.firwin(123, 0.25, window="blackman", fs=10.0), "type": "firfilter", + "filter_comments": [ + "Vector 1-second values are computed from 0.1-second values using the INTERMAGNET blackman filter centered on the second. Scalar 1-second values are computed from 0.1-second values using the INTERMAGNET blackman filter centered on the second. " + ], }, { # one second to one minute filter "name": "Intermagnet One Minute", + "data_interval": "minute", + "data_interval_type": "filtered 1-minute (00:15-01:45)", "input_sample_period": 1.0, "output_sample_period": 60.0, "window": sps.get_window(window=("gaussian", 15.8734), Nx=91), "type": "firfilter", + "filter_comments": [ + "Vector 1-minute values are computed from 1-second values using the INTERMAGNET gaussian filter centered on the minute. Scalar 1-minute values are computed from 1-second values using the INTERMAGNET gaussian filter centered on the minute. " + ], }, { # one minute to one hour filter "name": "One Hour", + "data_interval": "hour", + "data_interval_type": "filtered 1-hour", "input_sample_period": 60.0, "output_sample_period": 3600.0, "window": sps.windows.boxcar(60), "type": "average", + "filter_comments": [ + "Vector 1-hour values are computed from 1-minute values using a boxcar filter centered on the nearest half-hour. Scalar 1-hour values are computed from 1-minute values using a boxcar filter centered on the nearest half-hour. " + ], }, { # one minute to one hour filter "name": "One Day", + "data_interval": "day", + "data_interval_type": "filtered 1-Day", "input_sample_period": 60.0, "output_sample_period": 86400, "window": sps.windows.boxcar(1440), "type": "average", + "filter_comments": [ + "Vector 1-day values are computed from 1-minute values using a boxcar filter centered on the nearest half-day. Scalar 1-day values are computed from 1-minute values using a boxcar filter centered on the nearest half-day. " + ], }, ] @@ -129,6 +149,13 @@ class FilterAlgorithm(Algorithm): self.steps = [ { "name": "name" in data and data["name"] or "custom", + "data_interval": TimeseriesUtility.get_interval_from_delta( + self.output_sample_period + ), + "data_interval_type": "filtered custom interval", + "filter_comments": [ + "Data produced by filter utilizing custom coefficients and intervals." + ], "input_sample_period": self.input_sample_period, "output_sample_period": self.output_sample_period, "window": data["window"], @@ -268,6 +295,9 @@ class FilterAlgorithm(Algorithm): filtered = self.firfilter(data, window, decimation) stats = Stats(trace.stats) stats.delta = output_sample_period + stats.data_interval = step["data_interval"] + stats.data_interval_type = step["data_interval_type"] + stats.filter_comments = step["filter_comments"] stats.starttime = starttime stats.npts = len(filtered) trace_out = self.create_trace(stats.channel, stats, filtered) -- GitLab