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

Test hourly and daily filters

parent 1e359b79
No related branches found
No related tags found
2 merge requests!146Release CMO metadata to production,!17Implement hourly/daily filtering products
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
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
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
File added
File added
......@@ -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():
......
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