From 8f93bd1721caaddaafbb81a0cadceaccad6c1700 Mon Sep 17 00:00:00 2001
From: "E. Joshua Rigler" <erigler@usgs.gov>
Date: Mon, 10 Mar 2025 15:02:25 -0600
Subject: [PATCH] Clean up `geomag-filter realtime`; better match geomagio
 scripts:

- Remove unnecessary DED filtering; just copy to new sncls
- Trust *SNCL.py to map `HEZ` channel codes correctly (still uses `UVW` when applying calibrations to 10Hz volts and bins)
- Add `T5` to ObsRIO minute filtering
---
 geomagio/processing/filters.py | 49 +++++++++++-----------------------
 1 file changed, 15 insertions(+), 34 deletions(-)

diff --git a/geomagio/processing/filters.py b/geomagio/processing/filters.py
index 1cda8bf2..56ea3c01 100644
--- a/geomagio/processing/filters.py
+++ b/geomagio/processing/filters.py
@@ -242,7 +242,7 @@ def realtime_command(
         )
         minute_filter(
             observatory=observatory,
-            channels=("U", "V", "W"),
+            channels=("H", "E", "Z"),
             input_factory=EdgeFactory(
                 host=input_host,
                 port=input_port,  # earthworm port required for realtime
@@ -263,7 +263,7 @@ def realtime_command(
         # transmits scaled integer data
         minute_filter(
             observatory=observatory,
-            channels=("F", "T1", "T2", "T3", "T4"),
+            channels=("F", "T1", "T2", "T3", "T4", "T5"),
             input_factory=MiniSeedFactory(
                 host=input_host,
                 port=None,  # use MiniSeedFactory default
@@ -284,9 +284,9 @@ def realtime_command(
         _copy_channels(
             observatory=observatory,
             channels=(
-                ("U", "H"),
-                ("V", "E"),
-                ("W", "Z"),
+                ("H", "H"),
+                ("E", "E"),
+                ("Z", "Z"),
                 ("F", "F"),
             ),
             interval="minute",
@@ -312,9 +312,9 @@ def realtime_command(
         _copy_channels(
             observatory=observatory,
             channels=(
-                ("H", "U"),
-                ("E", "V"),
-                ("Z", "W"),
+                ("H", "H"),
+                ("E", "E"),
+                ("Z", "Z"),
                 ("F", "F"),
             ),
             interval="second",
@@ -334,32 +334,13 @@ def realtime_command(
             realtime_interval=realtime_interval,
             update_limit=update_limit,
         )
-        minute_filter(
-            observatory=observatory,
-            channels=("U", "V", "W", "F"),
-            input_factory=EdgeFactory(
-                host=input_host,
-                port=input_port,
-                type="variation",
-                sncl_mode="geomag",
-            ),
-            output_factory=EdgeFactory(
-                host=output_host,
-                port=output_read_port,
-                write_port=output_port,
-                type="variation",
-                sncl_mode="geomag",
-            ),
-            realtime_interval=realtime_interval,
-            update_limit=update_limit,
-        )
-        # remove the following after data migration is complete
+        # legacy PCDCP processing
         _copy_channels(
             observatory=observatory,
             channels=(
-                ("U", "H"),
-                ("V", "E"),
-                ("W", "Z"),
+                ("H", "H"),
+                ("E", "E"),
+                ("Z", "Z"),
                 ("F", "F"),
             ),
             interval="minute",
@@ -367,14 +348,14 @@ def realtime_command(
                 host=input_host,
                 port=input_port,
                 type="variation",
-                sncl_mode="geomag",
+                sncl_mode="legacy",
             ),
             output_factory=EdgeFactory(
                 host=output_host,
                 port=output_read_port,
-                write_port=7981,
+                write_port=output_port,
                 type="variation",
-                sncl_mode="legacy",
+                sncl_mode="geomag",
             ),
             realtime_interval=realtime_interval,
             update_limit=update_limit,
-- 
GitLab