From fdbfdc0e512384dc9eb926cdf3b8bc631f900974 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Mon, 5 Oct 2020 10:43:48 -0600 Subject: [PATCH 01/24] create_empty_trace for intervals above minutes --- geomagio/TimeseriesUtility.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/geomagio/TimeseriesUtility.py b/geomagio/TimeseriesUtility.py index 418bbe9c..1c64c522 100644 --- a/geomagio/TimeseriesUtility.py +++ b/geomagio/TimeseriesUtility.py @@ -46,6 +46,8 @@ def create_empty_trace( trace_starttime = obspy.core.UTCDateTime( numpy.ceil(starttime.timestamp / delta) * delta ) + if delta > 60.0: + trace_starttime += (delta - 60) / 2 stats.starttime = trace_starttime stats.delta = delta # Calculate number of valid samples up to or before endtime -- GitLab 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 02/24] 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 49353c0c..84b0f923 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 From 80089a5801b3197353c4350c1984cfa81e02b142 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Thu, 15 Oct 2020 15:07:54 -0600 Subject: [PATCH 03/24] Trim intervals under one hour --- geomagio/Controller.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/geomagio/Controller.py b/geomagio/Controller.py index f6517a4c..054f0bd0 100644 --- a/geomagio/Controller.py +++ b/geomagio/Controller.py @@ -187,6 +187,9 @@ class Controller(object): ) processed = algorithm.process(timeseries) # trim if --no-trim is not set + if options.output_interval not in [None, "tenhertz", "second", "minute"]: + starttime = processed[0].stats.starttime + endtime = processed[0].stats.endtime if not options.no_trim: processed.trim(starttime=starttime, endtime=endtime) if options.rename_output_channel: -- GitLab From b01488118e3012c6d2c6e89f40fe64220a7fdee0 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Thu, 15 Oct 2020 16:43:56 -0600 Subject: [PATCH 04/24] Update default realtime settings --- geomagio/Controller.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/geomagio/Controller.py b/geomagio/Controller.py index 054f0bd0..418e32b5 100644 --- a/geomagio/Controller.py +++ b/geomagio/Controller.py @@ -493,7 +493,11 @@ def main(args): if args.realtime: if args.realtime is True: # convert interval to number of seconds - if args.interval == "minute": + if args.interval == "day": + args.realtime = 172800 + elif args.interval == "hour": + args.realtime = 7200 + elif args.interval == "minute": args.realtime = 3600 else: args.realtime = 600 @@ -703,6 +707,8 @@ def parse_args(args): const=True, help=""" Run the last N seconds. + Default 172800 (last) when interval is day, + Default 7200 (last 2 hours) when interval is hour, Default 3600 (last hour) when interval is minute, Default 600 (last 10 minutes) otherwise. """, -- GitLab From fd3a5322e71f7483994221f6af27b306700d748e Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Fri, 16 Oct 2020 14:16:52 -0600 Subject: [PATCH 05/24] Change day step case, write tests --- geomagio/algorithm/FilterAlgorithm.py | 2 +- test/TimeseriesUtility_test.py | 28 +++++++++++++++++++++ test/algorithm_test/FilterAlgorithm_test.py | 12 +++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/geomagio/algorithm/FilterAlgorithm.py b/geomagio/algorithm/FilterAlgorithm.py index 84b0f923..1bdc0cf1 100644 --- a/geomagio/algorithm/FilterAlgorithm.py +++ b/geomagio/algorithm/FilterAlgorithm.py @@ -51,7 +51,7 @@ STEPS = [ { # one minute to one hour filter "name": "One Day", "data_interval": "day", - "data_interval_type": "filtered 1-Day", + "data_interval_type": "filtered 1-day", "input_sample_period": 60.0, "output_sample_period": 86400, "window": sps.windows.boxcar(1440), diff --git a/test/TimeseriesUtility_test.py b/test/TimeseriesUtility_test.py index a664b2e2..c3fbb918 100644 --- a/test/TimeseriesUtility_test.py +++ b/test/TimeseriesUtility_test.py @@ -55,6 +55,34 @@ def test_create_empty_trace(): TimeseriesUtility.pad_timeseries(timeseries, starttime - 90, endtime + 90) assert_equal(len(trace3.data), trace3.stats.npts) assert_equal(timeseries[0].stats.starttime, timeseries[2].stats.starttime) + # test hourly/daily starttime shift + hour_trace = TimeseriesUtility.create_empty_trace( + starttime=trace1.stats.starttime, + endtime=trace1.stats.endtime, + observatory=observatory, + channel="F", + type="variation", + interval="hour", + network=network, + station=trace1.stats.station, + location=location, + ) + + assert_equal(hour_trace.stats.starttime, UTCDateTime("2018-01-01T00:29:30Z")) + + day_trace = TimeseriesUtility.create_empty_trace( + starttime=trace1.stats.starttime, + endtime=trace1.stats.endtime, + observatory=observatory, + channel="F", + type="variation", + interval="day", + network=network, + station=trace1.stats.station, + location=location, + ) + + assert_equal(day_trace.stats.starttime, UTCDateTime("2018-01-01T11:59:30Z")) def test_get_stream_gaps(): diff --git a/test/algorithm_test/FilterAlgorithm_test.py b/test/algorithm_test/FilterAlgorithm_test.py index 6a194718..f235c162 100644 --- a/test/algorithm_test/FilterAlgorithm_test.py +++ b/test/algorithm_test/FilterAlgorithm_test.py @@ -51,6 +51,8 @@ def test_second(): assert_almost_equal(w_filt.data, w.data, 2) assert_equal(filtered[0].stats.starttime, UTCDateTime("2020-01-06T00:00:00Z")) assert_equal(filtered[0].stats.endtime, UTCDateTime("2020-01-06T04:00:00Z")) + assert_equal(u_filt.stats.data_interval, "second") + assert_equal(u_filt.stats.data_interval_type, "Average 1-Second") def test_minute(): @@ -94,6 +96,10 @@ def test_minute(): assert_almost_equal(w_filt.data, w.data, 2) assert_equal(filtered[0].stats.starttime, UTCDateTime("2020-01-06T00:00:00Z")) assert_equal(filtered[0].stats.endtime, UTCDateTime("2020-01-06T04:00:00Z")) + assert_equal(filtered[0].stats.data_interval, "minute") + assert_equal( + filtered[0].stats.data_interval_type, "filtered 1-minute (00:15-01:45)" + ) def test_hour(): @@ -138,6 +144,8 @@ def test_hour(): assert_almost_equal(f_filt.data, f.data, 2) assert_equal(filtered[0].stats.starttime, UTCDateTime("2020-08-31T00:29:30")) assert_equal(filtered[0].stats.endtime, UTCDateTime("2020-08-31T03:29:30")) + assert_equal(filtered[0].stats.data_interval, "hour") + assert_equal(filtered[0].stats.data_interval_type, "filtered 1-hour") def test_day(): @@ -182,6 +190,8 @@ def test_day(): assert_almost_equal(f_filt.data, f.data, 2) assert_equal(filtered[0].stats.starttime, UTCDateTime("2020-08-27T11:59:30")) assert_equal(filtered[0].stats.endtime, UTCDateTime("2020-08-30T11:59:30")) + assert_equal(filtered[0].stats.data_interval, "day") + assert_equal(filtered[0].stats.data_interval_type, "filtered 1-day") def test_custom(): @@ -229,6 +239,8 @@ def test_custom(): assert_almost_equal(w_filt.data, w.data, 2) assert_equal(filtered[0].stats.starttime, UTCDateTime("2020-01-06T00:00:00Z")) assert_equal(filtered[0].stats.endtime, UTCDateTime("2020-01-06T04:00:00Z")) + assert_equal(filtered[0].stats.data_interval, "second") + assert_equal(filtered[0].stats.data_interval_type, "filtered custom interval") def test_starttime_shift(): -- GitLab From df560400e6fb8bf5d3bc9f6eb744762703237649 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Tue, 20 Oct 2020 16:44:42 -0600 Subject: [PATCH 06/24] Simplify if statement in controller --- geomagio/Controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geomagio/Controller.py b/geomagio/Controller.py index 418e32b5..b6d768b3 100644 --- a/geomagio/Controller.py +++ b/geomagio/Controller.py @@ -187,7 +187,7 @@ class Controller(object): ) processed = algorithm.process(timeseries) # trim if --no-trim is not set - if options.output_interval not in [None, "tenhertz", "second", "minute"]: + if options.output_interval in ["hour", "day"]: starttime = processed[0].stats.starttime endtime = processed[0].stats.endtime if not options.no_trim: -- GitLab From a2d158b12a4031005fc198fa84e6806e4432f04a Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Tue, 20 Oct 2020 16:51:03 -0600 Subject: [PATCH 07/24] Account for starttime exceeding endtime --- geomagio/TimeseriesUtility.py | 4 ++++ test/TimeseriesUtility_test.py | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/geomagio/TimeseriesUtility.py b/geomagio/TimeseriesUtility.py index 1c64c522..230c87b3 100644 --- a/geomagio/TimeseriesUtility.py +++ b/geomagio/TimeseriesUtility.py @@ -2,6 +2,7 @@ from builtins import range from datetime import datetime import math +import sys import numpy import obspy.core @@ -48,6 +49,9 @@ def create_empty_trace( ) if delta > 60.0: trace_starttime += (delta - 60) / 2 + if trace_starttime > endtime: + sys.stderr.write("Starttime greater than endtime, shifting endtime to next sample") + endtime = trace_starttime + delta stats.starttime = trace_starttime stats.delta = delta # Calculate number of valid samples up to or before endtime diff --git a/test/TimeseriesUtility_test.py b/test/TimeseriesUtility_test.py index c3fbb918..f769ef3f 100644 --- a/test/TimeseriesUtility_test.py +++ b/test/TimeseriesUtility_test.py @@ -84,6 +84,21 @@ def test_create_empty_trace(): assert_equal(day_trace.stats.starttime, UTCDateTime("2018-01-01T11:59:30Z")) + short_trace = TimeseriesUtility.create_empty_trace( + starttime=trace1.stats.starttime, + endtime=trace1.stats.starttime + 1, + observatory=observatory, + channel="F", + type="variation", + interval="day", + network=network, + station=trace1.stats.station, + location=location, + ) + + assert_equal(short_trace.stats.starttime, UTCDateTime("2018-01-01T11:59:30Z")) + assert_equal(short_trace.stats.endtime, UTCDateTime("2018-01-02T11:59:30Z")) + def test_get_stream_gaps(): """TimeseriesUtility_test.test_get_stream_gaps() -- GitLab From 4c4d77815887098a10946ad7bf58ac38a0560c0f Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Tue, 20 Oct 2020 16:54:49 -0600 Subject: [PATCH 08/24] Make custom filter comment configurable --- geomagio/algorithm/FilterAlgorithm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/geomagio/algorithm/FilterAlgorithm.py b/geomagio/algorithm/FilterAlgorithm.py index 1bdc0cf1..1a3c7971 100644 --- a/geomagio/algorithm/FilterAlgorithm.py +++ b/geomagio/algorithm/FilterAlgorithm.py @@ -153,8 +153,10 @@ class FilterAlgorithm(Algorithm): self.output_sample_period ), "data_interval_type": "filtered custom interval", - "filter_comments": [ - "Data produced by filter utilizing custom coefficients and intervals." + "filter_comments": "filter_comments" in data + and data["filter_comments"] + or [ + "{ Data produced by filter utilizing custom coefficients and intervals. }" ], "input_sample_period": self.input_sample_period, "output_sample_period": self.output_sample_period, -- GitLab From 2cef2da2a01577799f592bc97c75bc10b760184e Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Tue, 20 Oct 2020 17:03:43 -0600 Subject: [PATCH 09/24] Black reformat --- geomagio/TimeseriesUtility.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/geomagio/TimeseriesUtility.py b/geomagio/TimeseriesUtility.py index 230c87b3..6b77e288 100644 --- a/geomagio/TimeseriesUtility.py +++ b/geomagio/TimeseriesUtility.py @@ -50,7 +50,9 @@ def create_empty_trace( if delta > 60.0: trace_starttime += (delta - 60) / 2 if trace_starttime > endtime: - sys.stderr.write("Starttime greater than endtime, shifting endtime to next sample") + sys.stderr.write( + "Starttime greater than endtime, shifting endtime to next sample" + ) endtime = trace_starttime + delta stats.starttime = trace_starttime stats.delta = delta -- GitLab From 9a113dbcc44ba95dcfd4d4279868421a00c35521 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Thu, 22 Oct 2020 11:32:25 -0600 Subject: [PATCH 10/24] Remove brackets from custom comment --- geomagio/algorithm/FilterAlgorithm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geomagio/algorithm/FilterAlgorithm.py b/geomagio/algorithm/FilterAlgorithm.py index 1a3c7971..1cf62989 100644 --- a/geomagio/algorithm/FilterAlgorithm.py +++ b/geomagio/algorithm/FilterAlgorithm.py @@ -156,7 +156,7 @@ class FilterAlgorithm(Algorithm): "filter_comments": "filter_comments" in data and data["filter_comments"] or [ - "{ Data produced by filter utilizing custom coefficients and intervals. }" + "Data produced by filter utilizing custom coefficients and intervals." ], "input_sample_period": self.input_sample_period, "output_sample_period": self.output_sample_period, -- GitLab From 9881046b6982d6e599eb4af0398a6cebf2620917 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Thu, 22 Oct 2020 12:31:36 -0600 Subject: [PATCH 11/24] Update filter comments --- geomagio/algorithm/FilterAlgorithm.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/geomagio/algorithm/FilterAlgorithm.py b/geomagio/algorithm/FilterAlgorithm.py index 1cf62989..027c034c 100644 --- a/geomagio/algorithm/FilterAlgorithm.py +++ b/geomagio/algorithm/FilterAlgorithm.py @@ -15,49 +15,49 @@ STEPS = [ { # 10 Hz to one second filter "name": "10Hz", "data_interval": "second", - "data_interval_type": "Average 1-Second", + "data_interval_type": "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. " + "Vector 1-second values are computed from 10 Hz values centered on the start of the second. Uses a centered Blackman filter." ], }, { # one second to one minute filter "name": "Intermagnet One Minute", "data_interval": "minute", - "data_interval_type": "filtered 1-minute (00:15-01:45)", + "data_interval_type": "1-minute", "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. " + "Scalar and Vector 1-minute values are computed from 1-second values centered on the start of the minute. Uses the centered INTERMAGNET gausian filter." ], }, { # one minute to one hour filter "name": "One Hour", "data_interval": "hour", - "data_interval_type": "filtered 1-hour", + "data_interval_type": "1-hour (00-59)", "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. " + "Scalar and Vector 1-hour values are computed from average of 1-minute values in the hour (00-59)", ], }, - { # one minute to one hour filter + { # one minute to one day filter "name": "One Day", "data_interval": "day", - "data_interval_type": "filtered 1-day", + "data_interval_type": "1-day (00:00-23:59)", "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. " + "Scalar and Vector 1-day values are computed from average of 1-minute values in the day (00:00-23:59)", ], }, ] -- GitLab From f2116e37c1b965d981071283850aa97d7d7e078c Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Thu, 22 Oct 2020 13:25:11 -0600 Subject: [PATCH 12/24] Adjust to one sample --- geomagio/TimeseriesUtility.py | 4 ++-- test/TimeseriesUtility_test.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/geomagio/TimeseriesUtility.py b/geomagio/TimeseriesUtility.py index 6b77e288..459287db 100644 --- a/geomagio/TimeseriesUtility.py +++ b/geomagio/TimeseriesUtility.py @@ -51,9 +51,9 @@ def create_empty_trace( trace_starttime += (delta - 60) / 2 if trace_starttime > endtime: sys.stderr.write( - "Starttime greater than endtime, shifting endtime to next sample" + "Starttime greater than endtime, adjusting request to one sample" ) - endtime = trace_starttime + delta + endtime = trace_starttime stats.starttime = trace_starttime stats.delta = delta # Calculate number of valid samples up to or before endtime diff --git a/test/TimeseriesUtility_test.py b/test/TimeseriesUtility_test.py index f769ef3f..0259364e 100644 --- a/test/TimeseriesUtility_test.py +++ b/test/TimeseriesUtility_test.py @@ -97,7 +97,7 @@ def test_create_empty_trace(): ) assert_equal(short_trace.stats.starttime, UTCDateTime("2018-01-01T11:59:30Z")) - assert_equal(short_trace.stats.endtime, UTCDateTime("2018-01-02T11:59:30Z")) + assert_equal(short_trace.stats.endtime, short_trace.stats.starttime) def test_get_stream_gaps(): -- GitLab From 67f6cff8b61b189617d731e60e751e92780f1ad6 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Thu, 22 Oct 2020 13:27:52 -0600 Subject: [PATCH 13/24] Update filter tests --- test/algorithm_test/FilterAlgorithm_test.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/algorithm_test/FilterAlgorithm_test.py b/test/algorithm_test/FilterAlgorithm_test.py index f235c162..b4c21d45 100644 --- a/test/algorithm_test/FilterAlgorithm_test.py +++ b/test/algorithm_test/FilterAlgorithm_test.py @@ -52,7 +52,7 @@ def test_second(): assert_equal(filtered[0].stats.starttime, UTCDateTime("2020-01-06T00:00:00Z")) assert_equal(filtered[0].stats.endtime, UTCDateTime("2020-01-06T04:00:00Z")) assert_equal(u_filt.stats.data_interval, "second") - assert_equal(u_filt.stats.data_interval_type, "Average 1-Second") + assert_equal(u_filt.stats.data_interval_type, "1-second") def test_minute(): @@ -97,9 +97,7 @@ def test_minute(): assert_equal(filtered[0].stats.starttime, UTCDateTime("2020-01-06T00:00:00Z")) assert_equal(filtered[0].stats.endtime, UTCDateTime("2020-01-06T04:00:00Z")) assert_equal(filtered[0].stats.data_interval, "minute") - assert_equal( - filtered[0].stats.data_interval_type, "filtered 1-minute (00:15-01:45)" - ) + assert_equal(filtered[0].stats.data_interval_type, "1-minute") def test_hour(): @@ -145,7 +143,7 @@ def test_hour(): assert_equal(filtered[0].stats.starttime, UTCDateTime("2020-08-31T00:29:30")) assert_equal(filtered[0].stats.endtime, UTCDateTime("2020-08-31T03:29:30")) assert_equal(filtered[0].stats.data_interval, "hour") - assert_equal(filtered[0].stats.data_interval_type, "filtered 1-hour") + assert_equal(filtered[0].stats.data_interval_type, "1-hour (00-59)") def test_day(): @@ -191,7 +189,7 @@ def test_day(): assert_equal(filtered[0].stats.starttime, UTCDateTime("2020-08-27T11:59:30")) assert_equal(filtered[0].stats.endtime, UTCDateTime("2020-08-30T11:59:30")) assert_equal(filtered[0].stats.data_interval, "day") - assert_equal(filtered[0].stats.data_interval_type, "filtered 1-day") + assert_equal(filtered[0].stats.data_interval_type, "1-day (00:00-23:59)") def test_custom(): -- GitLab From 74f6f4b4d40813a2d08b240e43ab9083a02b21c6 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Thu, 22 Oct 2020 13:38:39 -0600 Subject: [PATCH 14/24] Add new intervals to metadata --- geomagio/ObservatoryMetadata.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/geomagio/ObservatoryMetadata.py b/geomagio/ObservatoryMetadata.py index add0c635..8e78f898 100644 --- a/geomagio/ObservatoryMetadata.py +++ b/geomagio/ObservatoryMetadata.py @@ -941,8 +941,10 @@ DEFAULT_METADATA = { DEFAULT_INTERVAL_SPECIFIC = { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45) "}, - "second": {"data_interval_type": "Average 1-Second"}, + "day": {"data_interval_type": "1-day"}, + "hour": {"data_interval_type": "1-hour"}, + "minute": {"data_interval_type": "1-minute"}, + "second": {"data_interval_type": "1-second"}, } -- GitLab From 5e163b4a279eace5baf9a29db4194389a336743b Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Thu, 22 Oct 2020 13:50:28 -0600 Subject: [PATCH 15/24] Update metadata test --- test/ObservatoryMetadata_test.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/test/ObservatoryMetadata_test.py b/test/ObservatoryMetadata_test.py index 902abffb..00e650c2 100644 --- a/test/ObservatoryMetadata_test.py +++ b/test/ObservatoryMetadata_test.py @@ -24,24 +24,27 @@ METADATA = { }, "interval_specific": { "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", + "data_interval_type": "1-minute", "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. " + "Scalar and Vector 1-minute values are computed from 1-second values centered on the start of the minute. Uses the centered INTERMAGNET gausian filter." + ], + }, + "second": { + "data_interval_type": "1-second", + "filter_comments": [ + "Vector 1-second values are computed from 10 Hz values centered on the start of the second. Uses a centered Blackman filter." ], }, - "second": {"data_interval_type": "Average 1-Second"}, }, } } DATA_INTERVAL_TYPE = { - "minute": {"data_interval_type": "filtered 1-minute (00:29-01:30) "}, - "second": {"data_interval_type": "filtered 1-Second"}, + "day": {"data_interval_type": "1-day"}, + "hour": {"data_interval_type": "1-hour"}, + "minute": {"data_interval_type": "1-minute"}, + "second": {"data_interval_type": "1-second"}, } @@ -65,4 +68,4 @@ def test_set_metadata(): observatorymetadata.set_metadata(stats, "BOU", "MVH", "quasi-definitive", "second") assert_equal(stats["declination_base"], 20000) print(stats) - assert_equal(stats["data_interval_type"], "Average 1-Second") + assert_equal(stats["data_interval_type"], "1-second") -- GitLab From ebc836527991bedbd6948bb0c6a3fb6821c70715 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Fri, 23 Oct 2020 14:28:43 -0600 Subject: [PATCH 16/24] Move trim comment --- geomagio/Controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geomagio/Controller.py b/geomagio/Controller.py index b6d768b3..b1d4302f 100644 --- a/geomagio/Controller.py +++ b/geomagio/Controller.py @@ -186,10 +186,10 @@ class Controller(object): timeseries=timeseries, renames=options.rename_input_channel ) processed = algorithm.process(timeseries) - # trim if --no-trim is not set if options.output_interval in ["hour", "day"]: starttime = processed[0].stats.starttime endtime = processed[0].stats.endtime + # trim if --no-trim is not set if not options.no_trim: processed.trim(starttime=starttime, endtime=endtime) if options.rename_output_channel: -- GitLab From 6e82c6e87168717f8fcb479b042c2c25d6441d02 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Fri, 23 Oct 2020 14:29:27 -0600 Subject: [PATCH 17/24] Change help statment for realtime --- geomagio/Controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geomagio/Controller.py b/geomagio/Controller.py index b1d4302f..adf42c83 100644 --- a/geomagio/Controller.py +++ b/geomagio/Controller.py @@ -707,7 +707,7 @@ def parse_args(args): const=True, help=""" Run the last N seconds. - Default 172800 (last) when interval is day, + Default 172800 (last 2 days) when interval is day, Default 7200 (last 2 hours) when interval is hour, Default 3600 (last hour) when interval is minute, Default 600 (last 10 minutes) otherwise. -- GitLab From e2b8a0ffa0950b9e59d067ab92eed0263d7d4c97 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Fri, 23 Oct 2020 14:31:56 -0600 Subject: [PATCH 18/24] Change filter comments --- geomagio/algorithm/FilterAlgorithm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geomagio/algorithm/FilterAlgorithm.py b/geomagio/algorithm/FilterAlgorithm.py index 027c034c..50aa2f72 100644 --- a/geomagio/algorithm/FilterAlgorithm.py +++ b/geomagio/algorithm/FilterAlgorithm.py @@ -21,7 +21,7 @@ STEPS = [ "window": sps.firwin(123, 0.25, window="blackman", fs=10.0), "type": "firfilter", "filter_comments": [ - "Vector 1-second values are computed from 10 Hz values centered on the start of the second. Uses a centered Blackman filter." + "Vector 1-second values are computed from 10 Hz values using a Blackman filter (123 taps, cutoff 0.25Hz) centered on the start of the second." ], }, { # one second to one minute filter @@ -33,7 +33,7 @@ STEPS = [ "window": sps.get_window(window=("gaussian", 15.8734), Nx=91), "type": "firfilter", "filter_comments": [ - "Scalar and Vector 1-minute values are computed from 1-second values centered on the start of the minute. Uses the centered INTERMAGNET gausian filter." + "Scalar and Vector 1-minute values are computed from 1 Hz values using an INTERMAGNET gaussian filter centered on the start of the minute (00:30-01:30)." ], }, { # one minute to one hour filter -- GitLab From faf84bae0a85bb8a9a9057e107764f10d995bbd9 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Fri, 23 Oct 2020 14:58:06 -0600 Subject: [PATCH 19/24] Add default interval information to observatory metadata --- test/ObservatoryMetadata_test.py | 41 +++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/test/ObservatoryMetadata_test.py b/test/ObservatoryMetadata_test.py index 00e650c2..a6530991 100644 --- a/test/ObservatoryMetadata_test.py +++ b/test/ObservatoryMetadata_test.py @@ -4,6 +4,32 @@ from geomagio import ObservatoryMetadata from numpy.testing import assert_equal import obspy.core +DEFAULT_INTERVAL_SPECIFIC = { + "day": { + "data_interval_type": "1-day (00:00-23:59)", + "filter_comments": [ + "Scalar and Vector 1-day values are computed from average of 1-minute values in the day (00:00-23:59)", + ], + }, + "hour": { + "data_interval_type": "1-hour (00-59)", + "filter_comments": [ + "Scalar and Vector 1-hour values are computed from average of 1-minute values in the hour (00-59)", + ], + }, + "minute": { + "data_interval_type": "1-minute", + "filter_comments": [ + "Scalar and Vector 1-minute values are computed from 1 Hz values using an INTERMAGNET gaussian filter centered on the start of the minute (00:30-01:30)." + ], + }, + "second": { + "data_interval_type": "1-second", + "filter_comments": [ + "Vector 1-second values are computed from 10 Hz values using a Blackman filter (123 taps, cutoff 0.25Hz) centered on the start of the second." + ], + }, +} METADATA = { "BOU": { @@ -22,20 +48,7 @@ METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "1-minute", - "filter_comments": [ - "Scalar and Vector 1-minute values are computed from 1-second values centered on the start of the minute. Uses the centered INTERMAGNET gausian filter." - ], - }, - "second": { - "data_interval_type": "1-second", - "filter_comments": [ - "Vector 1-second values are computed from 10 Hz values centered on the start of the second. Uses a centered Blackman filter." - ], - }, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, } } -- GitLab From f7c7c6f9ace6c99abd0b6a4c6a0864463d01956e Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Mon, 26 Oct 2020 09:19:28 -0600 Subject: [PATCH 20/24] Move interval metadata outside of test --- geomagio/ObservatoryMetadata.py | 27 +++++++++++++++++++++++++++ test/ObservatoryMetadata_test.py | 28 +--------------------------- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/geomagio/ObservatoryMetadata.py b/geomagio/ObservatoryMetadata.py index 8e78f898..2a777911 100644 --- a/geomagio/ObservatoryMetadata.py +++ b/geomagio/ObservatoryMetadata.py @@ -1,5 +1,32 @@ """Factory that loads metadata for an observatory""" +# default metadata for available time intervals +DEFAULT_INTERVAL_SPECIFIC = { + "day": { + "data_interval_type": "1-day (00:00-23:59)", + "filter_comments": [ + "Scalar and Vector 1-day values are computed from average of 1-minute values in the day (00:00-23:59)", + ], + }, + "hour": { + "data_interval_type": "1-hour (00-59)", + "filter_comments": [ + "Scalar and Vector 1-hour values are computed from average of 1-minute values in the hour (00-59)", + ], + }, + "minute": { + "data_interval_type": "1-minute", + "filter_comments": [ + "Scalar and Vector 1-minute values are computed from 1 Hz values using an INTERMAGNET gaussian filter centered on the start of the minute (00:30-01:30)." + ], + }, + "second": { + "data_interval_type": "1-second", + "filter_comments": [ + "Vector 1-second values are computed from 10 Hz values using a Blackman filter (123 taps, cutoff 0.25Hz) centered on the start of the second." + ], + }, +} # default metadata for the 14 USGS observatories. DEFAULT_METADATA = { diff --git a/test/ObservatoryMetadata_test.py b/test/ObservatoryMetadata_test.py index a6530991..ca3d5ada 100644 --- a/test/ObservatoryMetadata_test.py +++ b/test/ObservatoryMetadata_test.py @@ -1,35 +1,9 @@ """Tests for ObservatoryMetadata.py""" -from geomagio import ObservatoryMetadata +from geomagio.ObservatoryMetadata import ObservatoryMetadata, DEFAULT_INTERVAL_SPECIFIC from numpy.testing import assert_equal import obspy.core -DEFAULT_INTERVAL_SPECIFIC = { - "day": { - "data_interval_type": "1-day (00:00-23:59)", - "filter_comments": [ - "Scalar and Vector 1-day values are computed from average of 1-minute values in the day (00:00-23:59)", - ], - }, - "hour": { - "data_interval_type": "1-hour (00-59)", - "filter_comments": [ - "Scalar and Vector 1-hour values are computed from average of 1-minute values in the hour (00-59)", - ], - }, - "minute": { - "data_interval_type": "1-minute", - "filter_comments": [ - "Scalar and Vector 1-minute values are computed from 1 Hz values using an INTERMAGNET gaussian filter centered on the start of the minute (00:30-01:30)." - ], - }, - "second": { - "data_interval_type": "1-second", - "filter_comments": [ - "Vector 1-second values are computed from 10 Hz values using a Blackman filter (123 taps, cutoff 0.25Hz) centered on the start of the second." - ], - }, -} METADATA = { "BOU": { -- GitLab From 7de1749d3df59987d822f4d1899876ab13c60229 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Mon, 26 Oct 2020 09:31:58 -0600 Subject: [PATCH 21/24] Update interval specific info for USGS observatories --- geomagio/ObservatoryMetadata.py | 232 +++----------------------------- 1 file changed, 16 insertions(+), 216 deletions(-) diff --git a/geomagio/ObservatoryMetadata.py b/geomagio/ObservatoryMetadata.py index 2a777911..94a610bf 100644 --- a/geomagio/ObservatoryMetadata.py +++ b/geomagio/ObservatoryMetadata.py @@ -46,19 +46,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "BOU": { "metadata": { @@ -76,19 +64,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "TST": { "metadata": { @@ -106,19 +82,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "BRW": { "metadata": { @@ -196,19 +160,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "CMO": { "metadata": { @@ -260,19 +212,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "DHT": { "metadata": { @@ -290,19 +230,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "FRD": { "metadata": { @@ -320,19 +248,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "FDT": { "metadata": { @@ -350,19 +266,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "FRN": { "metadata": { @@ -380,19 +284,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "GUA": { "metadata": { @@ -410,19 +302,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "HON": { "metadata": { @@ -440,19 +320,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "KAK": { "metadata": { @@ -491,19 +359,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "SHU": { "metadata": { @@ -521,19 +377,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "SIT": { "metadata": { @@ -551,19 +395,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "SJG": { "metadata": { @@ -581,19 +413,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "TUC": { "metadata": { @@ -611,19 +431,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "USGS": { "metadata": { @@ -967,14 +775,6 @@ DEFAULT_METADATA = { } -DEFAULT_INTERVAL_SPECIFIC = { - "day": {"data_interval_type": "1-day"}, - "hour": {"data_interval_type": "1-hour"}, - "minute": {"data_interval_type": "1-minute"}, - "second": {"data_interval_type": "1-second"}, -} - - class ObservatoryMetadata(object): """Helper class for providing all the metadata needed for a geomag timeseries. -- GitLab From 181139dc7e73e1c57c5f9102fdb407d7bec9ef77 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Mon, 26 Oct 2020 09:44:13 -0600 Subject: [PATCH 22/24] Add comment for start/end time adjustment --- geomagio/Controller.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/geomagio/Controller.py b/geomagio/Controller.py index adf42c83..2d6bf659 100644 --- a/geomagio/Controller.py +++ b/geomagio/Controller.py @@ -186,6 +186,8 @@ class Controller(object): timeseries=timeseries, renames=options.rename_input_channel ) processed = algorithm.process(timeseries) + # for averaging filter steps, return data with aligned starttime/endtime + # if no data is available, return empty trace with aligned starttime/endtime if options.output_interval in ["hour", "day"]: starttime = processed[0].stats.starttime endtime = processed[0].stats.endtime -- GitLab From 3d3ad9e70ec56552af31f6d14e0c5ccce01e50b1 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Mon, 26 Oct 2020 12:40:36 -0600 Subject: [PATCH 23/24] Update USGS and external observatory interval information --- geomagio/ObservatoryMetadata.py | 122 ++++++-------------------------- 1 file changed, 23 insertions(+), 99 deletions(-) diff --git a/geomagio/ObservatoryMetadata.py b/geomagio/ObservatoryMetadata.py index 94a610bf..593310d8 100644 --- a/geomagio/ObservatoryMetadata.py +++ b/geomagio/ObservatoryMetadata.py @@ -100,19 +100,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "data_interval_type": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "BRT": { "metadata": { @@ -130,19 +118,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "data_interval_type": { - "minute": { - "data_interval_type": "filtered 1-minute (00:15-01:45) ", - "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. " - ], - }, - "second": {"data_interval_type": "Average 1-Second"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "BSL": { "metadata": { @@ -177,7 +153,8 @@ DEFAULT_METADATA = { "conditions_of_use": "The Conditions of Use for data provided" + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", - } + }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "CMT": { "metadata": { @@ -194,7 +171,8 @@ DEFAULT_METADATA = { "conditions_of_use": "The Conditions of Use for data provided" + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", - } + }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "DED": { "metadata": { @@ -338,10 +316,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "NEW": { "metadata": { @@ -449,13 +424,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": { - "data_interval_type": "1-minute calculated", - "filter_comments": [], - }, - "hour": {"data_interval_type": "1-hour calculated"}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "BLC": { "metadata": { @@ -473,10 +442,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "BRD": { "metadata": { @@ -494,10 +460,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "CBB": { "metadata": { @@ -515,10 +478,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "EUA": { "metadata": { @@ -536,10 +496,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "FCC": { "metadata": { @@ -557,10 +514,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "HAD": { "metadata": { @@ -578,10 +532,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "HER": { "metadata": { @@ -599,10 +550,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "IQA": { "metadata": { @@ -620,10 +568,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "MEA": { "metadata": { @@ -641,10 +586,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "OTT": { "metadata": { @@ -662,10 +604,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "RES": { "metadata": { @@ -683,10 +622,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "SNK": { "metadata": { @@ -704,10 +640,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "STJ": { "metadata": { @@ -725,10 +658,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "VIC": { "metadata": { @@ -746,10 +676,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, "YKC": { "metadata": { @@ -767,10 +694,7 @@ DEFAULT_METADATA = { + " through INTERMAGNET and acknowledgement templates" + " can be found at www.intermagnet.org", }, - "interval_specific": { - "minute": {"data_interval_type": "filtered 1-minute (00:15-01:45)"}, - "second": {"data_interval_type": ""}, - }, + "interval_specific": DEFAULT_INTERVAL_SPECIFIC, }, } -- GitLab From ce85b6f107e63aabf5f174a831f88007f2d69e83 Mon Sep 17 00:00:00 2001 From: pcain-usgs <pcain@usgs.gov> Date: Tue, 27 Oct 2020 12:17:29 -0600 Subject: [PATCH 24/24] Remove adaptations to controller trimming --- geomagio/Controller.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/geomagio/Controller.py b/geomagio/Controller.py index 2d6bf659..7111ef57 100644 --- a/geomagio/Controller.py +++ b/geomagio/Controller.py @@ -186,11 +186,6 @@ class Controller(object): timeseries=timeseries, renames=options.rename_input_channel ) processed = algorithm.process(timeseries) - # for averaging filter steps, return data with aligned starttime/endtime - # if no data is available, return empty trace with aligned starttime/endtime - if options.output_interval in ["hour", "day"]: - starttime = processed[0].stats.starttime - endtime = processed[0].stats.endtime # trim if --no-trim is not set if not options.no_trim: processed.trim(starttime=starttime, endtime=endtime) -- GitLab