diff --git a/etc/filter/BOU20200831vday.day b/etc/filter/BOU20200831vday.day new file mode 100644 index 0000000000000000000000000000000000000000..94858b73c0a6ade10b0f89955ec2f3fa866efc70 --- /dev/null +++ b/etc/filter/BOU20200831vday.day @@ -0,0 +1,26 @@ + Format IAGA-2002 | + Source of Data United States Geological Survey (USGS) | + Station Name Boulder | + IAGA CODE BOU | + Geodetic Latitude 40.137 | + Geodetic Longitude 254.763 | + Elevation 1682 | + Reported HEZF | + Sensor Orientation HDZF | + Digital Sampling 0.01 second | + Data Interval Type filtered 1-minute (00:15-01:45) | + Data Type variation | + # DECBAS 5527 (Baseline declination value in | + # tenths of minutes East (0-216,000)). | + # 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. | + # CONDITIONS OF USE: The Conditions of Use for data provided | + # through INTERMAGNET and acknowledgement templates can be found at | + # www.intermagnet.org | +DATE TIME DOY BOUH BOUE BOUZ BOUF | +2020-08-27 11:59:30.000 240 20817.44 -110.62 46800.86 51739.31 +2020-08-28 11:59:30.000 241 20817.73 -111.55 46799.29 51738.09 +2020-08-29 11:59:30.000 242 20804.21 -109.16 46800.15 51733.70 +2020-08-30 11:59:30.000 243 20808.16 -109.66 46803.17 51738.29 diff --git a/etc/filter/BOU20200831vhor.hor b/etc/filter/BOU20200831vhor.hor new file mode 100644 index 0000000000000000000000000000000000000000..c721fe096ba82490efbb294325da3986d9163b63 --- /dev/null +++ b/etc/filter/BOU20200831vhor.hor @@ -0,0 +1,26 @@ + Format IAGA-2002 | + Source of Data United States Geological Survey (USGS) | + Station Name Boulder | + IAGA CODE BOU | + Geodetic Latitude 40.137 | + Geodetic Longitude 254.763 | + Elevation 1682 | + Reported HEZF | + Sensor Orientation HDZF | + Digital Sampling 0.01 second | + Data Interval Type filtered 1-minute (00:15-01:45) | + Data Type variation | + # DECBAS 5527 (Baseline declination value in | + # tenths of minutes East (0-216,000)). | + # 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. | + # CONDITIONS OF USE: The Conditions of Use for data provided | + # through INTERMAGNET and acknowledgement templates can be found at | + # www.intermagnet.org | +DATE TIME DOY BOUH BOUE BOUZ BOUF | +2020-08-31 00:29:30.000 244 20778.61 -99.10 46814.71 51737.42 +2020-08-31 01:29:30.000 244 20777.91 -102.77 46814.63 51737.11 +2020-08-31 02:29:30.000 244 20789.41 -96.59 46814.35 51741.37 +2020-08-31 03:29:30.000 244 20813.68 -73.96 46808.12 51745.12 diff --git a/etc/filter/LLO20200106vhor.hor b/etc/filter/LLO20200106vhor.hor deleted file mode 100644 index bb6a60d077cd341939eff9e729a2c40585b85e76..0000000000000000000000000000000000000000 --- a/etc/filter/LLO20200106vhor.hor +++ /dev/null @@ -1,9 +0,0 @@ - Format IAGA-2002 | - IAGA CODE LLO | - Reported UVWNUL | -DATE TIME DOY LLOU LLOV LLOW LLONUL | -2020-01-06 00:00:00.000 006 8330.00 -18971.07 39294.07 99999.00 -2020-01-06 01:00:00.000 006 8341.78 -18959.85 39294.98 99999.00 -2020-01-06 02:00:00.000 006 8363.88 -18962.53 39294.24 99999.00 -2020-01-06 03:00:00.000 006 8305.76 -18932.89 39305.85 99999.00 -2020-01-06 04:00:00.000 006 8320.99 -18990.56 39275.92 99999.00 diff --git a/etc/filter/day_filter_min.mseed b/etc/filter/day_filter_min.mseed new file mode 100644 index 0000000000000000000000000000000000000000..412c009d4a756661707eee3533de147cff41957b Binary files /dev/null and b/etc/filter/day_filter_min.mseed differ diff --git a/etc/filter/hor_filter_min.mseed b/etc/filter/hor_filter_min.mseed new file mode 100644 index 0000000000000000000000000000000000000000..1917ade005d7bc1518a8f073c38ee86acf450fc0 Binary files /dev/null and b/etc/filter/hor_filter_min.mseed differ diff --git a/test/algorithm_test/FilterAlgorithm_test.py b/test/algorithm_test/FilterAlgorithm_test.py index 6bfc3fbdecbaad678d57feb1f3d9cc8eefaac5f1..f7d43b1762122a320d13ca46bb9f697b2f823a95 100644 --- a/test/algorithm_test/FilterAlgorithm_test.py +++ b/test/algorithm_test/FilterAlgorithm_test.py @@ -91,45 +91,88 @@ def test_minute(): assert_almost_equal(w_filt.data, w.data, 2) -# def test_hour(): -# """algorithm_test.FilterAlgorithm_test.test_hour() -# Tests algorithm for 10Hz to hour. -# """ -# f = FilterAlgorithm(input_sample_period=0.1, output_sample_period=3600.0) - -# # generation of 10HZ_filter_hor.mseed -# # starttime = UTCDateTime('2020-01-06T00:00:00Z') -# # endtime = UTCDateTime('2020-01-06T04:00:00Z') -# # m = MiniSeedFactory(port=2061, host='...', -# # convert_channels=['U', 'V', 'W']) -# # f = FilterAlgorithm(input_sample_period=0.1, -# # output_sample_period=3600.0) -# # starttime, endtime = f.get_input_interval(starttime,endtime) -# # LLO = m.get_timeseries(observatory='LLO', -# # starttime=starttime,endtime=endtime, -# # channels=['U_Volt', 'U_Bin', 'V_Volt', -# # 'V_Bin', 'W_Volt', 'W_Bin'], -# # interval='tenhertz', type='variaton') -# # LLO.write('10HZ_filter_hor.mseed') - -# llo = read("etc/filter/10HZ_filter_hor.mseed") -# filtered = f.process(llo) - -# with open("etc/filter/LLO20200106vhor.hor", "r") as f: -# iaga = i2.StreamIAGA2002Factory(stream=f) -# LLO = iaga.get_timeseries(starttime=None, endtime=None, observatory="LLO") - -# u = LLO.select(channel="U")[0] -# v = LLO.select(channel="V")[0] -# w = LLO.select(channel="W")[0] - -# u_filt = filtered.select(channel="U")[0] -# v_filt = filtered.select(channel="V")[0] -# w_filt = filtered.select(channel="W")[0] - -# assert_almost_equal(u_filt.data, u.data, 2) -# assert_almost_equal(v_filt.data, v.data, 2) -# assert_almost_equal(w_filt.data, w.data, 2) +def test_hour(): + """algorithm_test.FilterAlgorithm_test.test_hour() + Tests algorithm for 1min to hour. + """ + f = FilterAlgorithm(input_sample_period=60.0, output_sample_period=3600.0) + + # generation of hor_filter_min.mseed + # starttime = UTCDateTime("2020-01-31T00:00:00Z") + # endtime = UTCDateTime("2020-01-31T04:00:00Z") + # e = EdgeFactory() + # f = FilterAlgorithm(input_sample_period=60.0, + # output_sample_period=3600.0) + # starttime, endtime = f.get_input_interval(starttime,endtime) + # BOU = e.get_timeseries(observatory='BOU', + # starttime=starttime,endtime=endtime, + # channels=["H", "E", "Z", "F"], + # interval="minute", type='variaton') + # LLO.write('hour_filter_min.mseed') + + bou = read("etc/filter/hor_filter_min.mseed") + filtered = f.process(bou) + + with open("etc/filter/BOU20200831vhor.hor", "r") as f: + iaga = i2.StreamIAGA2002Factory(stream=f) + BOU = iaga.get_timeseries(starttime=None, endtime=None, observatory="BOU") + + h = BOU.select(channel="H")[0] + e = BOU.select(channel="E")[0] + z = BOU.select(channel="Z")[0] + f = BOU.select(channel="F")[0] + + h_filt = filtered.select(channel="H")[0] + e_filt = filtered.select(channel="E")[0] + z_filt = filtered.select(channel="Z")[0] + f_filt = filtered.select(channel="F")[0] + + assert_almost_equal(h_filt.data, h.data, 2) + assert_almost_equal(e_filt.data, e.data, 2) + assert_almost_equal(z_filt.data, z.data, 2) + assert_almost_equal(f_filt.data, f.data, 2) + + +def test_day(): + """algorithm_test.FilterAlgorithm_test.test_hour() + Tests algorithm for 1min to day. + """ + f = FilterAlgorithm(input_sample_period=60.0, output_sample_period=86400.0) + + # generation of day_filter_min.mseed + # starttime = UTCDateTime("2020-01-31T00:00:00Z") + # endtime = UTCDateTime("2020-01-31T04:00:00Z") + # e = EdgeFactory() + # f = FilterAlgorithm(input_sample_period=60.0, + # output_sample_period=86400.0) + # starttime, endtime = f.get_input_interval(starttime,endtime) + # BOU = e.get_timeseries(observatory='BOU', + # starttime=starttime,endtime=endtime, + # channels=["H", "E", "Z", "F"], + # interval="minute", type='variaton') + # LLO.write('day_filter_min.mseed') + + bou = read("etc/filter/day_filter_min.mseed") + filtered = f.process(bou) + + with open("etc/filter/BOU20200831vday.day", "r") as f: + iaga = i2.StreamIAGA2002Factory(stream=f) + BOU = iaga.get_timeseries(starttime=None, endtime=None, observatory="BOU") + + h = BOU.select(channel="H")[0] + e = BOU.select(channel="E")[0] + z = BOU.select(channel="Z")[0] + f = BOU.select(channel="F")[0] + + h_filt = filtered.select(channel="H")[0] + e_filt = filtered.select(channel="E")[0] + z_filt = filtered.select(channel="Z")[0] + f_filt = filtered.select(channel="F")[0] + + assert_almost_equal(h_filt.data, h.data, 2) + assert_almost_equal(e_filt.data, e.data, 2) + assert_almost_equal(z_filt.data, z.data, 2) + assert_almost_equal(f_filt.data, f.data, 2) def test_custom():