Skip to content
Snippets Groups Projects
Commit 46b197ca authored by Erin (Josh) Rigler's avatar Erin (Josh) Rigler
Browse files

Merge branch 'filter-temps-hour-day' into 'master'

filter legacy temperature channels at 1 hour and 1 day

See merge request !165
parents 15bbfd00 f5c10e14
No related branches found
No related tags found
2 merge requests!166Merge branch master into production,!165filter legacy temperature channels at 1 hour and 1 day
Pipeline #91336 passed
...@@ -30,7 +30,9 @@ def day_command( ...@@ -30,7 +30,9 @@ def day_command(
observatory: str = Argument(None, help="observatory id"), observatory: str = Argument(None, help="observatory id"),
input_host: str = Option("127.0.0.1", help="host to request data from"), input_host: str = Option("127.0.0.1", help="host to request data from"),
output_host: str = Option("127.0.0.1", help="host to write data to"), output_host: str = Option("127.0.0.1", help="host to write data to"),
realtime_interval: int = Option(86400, help="length of update window (in seconds)"), realtime_interval: int = Option(
604800, help="length of update window (in seconds)"
),
update_limit: int = Option(7, help="number of update windows"), update_limit: int = Option(7, help="number of update windows"),
): ):
day_filter( day_filter(
...@@ -40,6 +42,21 @@ def day_command( ...@@ -40,6 +42,21 @@ def day_command(
realtime_interval=realtime_interval, realtime_interval=realtime_interval,
update_limit=update_limit, update_limit=update_limit,
) )
temperature_filter(
observatory=observatory,
channels=(
("UK1", "PK1"),
("UK2", "PK2"),
("UK3", "PK3"),
("UK4", "PK4"),
),
input_factory=get_edge_factory(host=input_host),
input_interval="minute",
output_factory=get_miniseed_factory(host=output_host),
output_interval="day",
realtime_interval=realtime_interval,
update_limit=update_limit,
)
@app.command( @app.command(
...@@ -50,7 +67,7 @@ def hour_command( ...@@ -50,7 +67,7 @@ def hour_command(
observatory: str = Argument(None, help="observatory id"), observatory: str = Argument(None, help="observatory id"),
input_host: str = Option("127.0.0.1", help="host to request data from"), input_host: str = Option("127.0.0.1", help="host to request data from"),
output_host: str = Option("127.0.0.1", help="host to write data to"), output_host: str = Option("127.0.0.1", help="host to write data to"),
realtime_interval: int = Option(3600, help="length of update window (in seconds)"), realtime_interval: int = Option(86400, help="length of update window (in seconds)"),
update_limit: int = Option(24, help="number of update windows"), update_limit: int = Option(24, help="number of update windows"),
): ):
hour_filter( hour_filter(
...@@ -60,6 +77,21 @@ def hour_command( ...@@ -60,6 +77,21 @@ def hour_command(
realtime_interval=realtime_interval, realtime_interval=realtime_interval,
update_limit=update_limit, update_limit=update_limit,
) )
temperature_filter(
observatory=observatory,
channels=(
("UK1", "RK1"),
("UK2", "RK2"),
("UK3", "RK3"),
("UK4", "RK4"),
),
input_factory=get_edge_factory(host=input_host),
input_interval="minute",
output_factory=get_miniseed_factory(host=output_host),
output_interval="hour",
realtime_interval=realtime_interval,
update_limit=update_limit,
)
@app.command( @app.command(
...@@ -118,8 +150,16 @@ def realtime_command( ...@@ -118,8 +150,16 @@ def realtime_command(
) )
temperature_filter( temperature_filter(
observatory=observatory, observatory=observatory,
channels=(
("LK1", "UK1"),
("LK2", "UK2"),
("LK3", "UK3"),
("LK4", "UK4"),
),
input_factory=get_miniseed_factory(host=input_host), input_factory=get_miniseed_factory(host=input_host),
input_interval="second",
output_factory=get_edge_factory(host=output_host), output_factory=get_edge_factory(host=output_host),
output_interval="minute",
realtime_interval=realtime_interval, realtime_interval=realtime_interval,
update_limit=update_limit, update_limit=update_limit,
) )
...@@ -165,7 +205,7 @@ def realtime_command( ...@@ -165,7 +205,7 @@ def realtime_command(
def day_filter( def day_filter(
observatory: str, observatory: str,
channels: List[str] = ["U", "V", "W", "F", "T1", "T2", "T3", "T4"], channels: List[str] = ["U", "V", "W", "F"],
input_factory: Optional[TimeseriesFactory] = None, input_factory: Optional[TimeseriesFactory] = None,
output_factory: Optional[TimeseriesFactory] = None, output_factory: Optional[TimeseriesFactory] = None,
realtime_interval: int = 86400, realtime_interval: int = 86400,
...@@ -216,7 +256,7 @@ def day_filter( ...@@ -216,7 +256,7 @@ def day_filter(
def hour_filter( def hour_filter(
observatory: str, observatory: str,
channels: List[str] = ["U", "V", "W", "F", "T1", "T2", "T3", "T4"], channels: List[str] = ["U", "V", "W", "F"],
input_factory: Optional[TimeseriesFactory] = None, input_factory: Optional[TimeseriesFactory] = None,
output_factory: Optional[TimeseriesFactory] = None, output_factory: Optional[TimeseriesFactory] = None,
realtime_interval: int = 600, realtime_interval: int = 600,
...@@ -367,8 +407,11 @@ def second_filter( ...@@ -367,8 +407,11 @@ def second_filter(
def temperature_filter( def temperature_filter(
observatory: str, observatory: str,
channels: List[List[str]],
input_factory: Optional[TimeseriesFactory] = None, input_factory: Optional[TimeseriesFactory] = None,
input_interval: int = "second",
output_factory: Optional[TimeseriesFactory] = None, output_factory: Optional[TimeseriesFactory] = None,
output_interval: int = "minute",
realtime_interval: int = 600, realtime_interval: int = 600,
update_limit: int = 10, update_limit: int = 10,
): ):
...@@ -376,13 +419,11 @@ def temperature_filter( ...@@ -376,13 +419,11 @@ def temperature_filter(
starttime, endtime = get_realtime_interval(realtime_interval) starttime, endtime = get_realtime_interval(realtime_interval)
controller = Controller( controller = Controller(
inputFactory=input_factory or get_miniseed_factory(), inputFactory=input_factory or get_miniseed_factory(),
inputInterval="second", inputInterval=input_interval,
outputFactory=output_factory or get_edge_factory(), outputFactory=output_factory or get_edge_factory(),
outputInterval="minute", outputInterval=output_interval,
) )
renames = {"LK1": "UK1", "LK2": "UK2", "LK3": "UK3", "LK4": "UK4"} for input_channel, output_channel in channels:
for input_channel in renames.keys():
output_channel = renames[input_channel]
controller.run_as_update( controller.run_as_update(
algorithm=FilterAlgorithm( algorithm=FilterAlgorithm(
input_sample_period=1, input_sample_period=1,
......
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