From 7bab1926ef3abbfe4645105c74de83f7da906274 Mon Sep 17 00:00:00 2001
From: pcain <pcain@usgs.gov>
Date: Thu, 21 Oct 2021 18:48:23 +0000
Subject: [PATCH] controller input_factory option for IRISFactory

---
 geomagio/Controller.py | 39 +++++++++++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/geomagio/Controller.py b/geomagio/Controller.py
index e1961fa0..78e62aa3 100644
--- a/geomagio/Controller.py
+++ b/geomagio/Controller.py
@@ -514,7 +514,7 @@ def get_input_factory(args):
             host=args.input_host,
             port=args.input_port,
             locationCode=args.locationcode,
-            **input_factory_args
+            **input_factory_args,
         )
     elif input_type == "miniseed":
         input_factory = edge.MiniSeedFactory(
@@ -522,7 +522,7 @@ def get_input_factory(args):
             port=args.input_port,
             locationCode=args.locationcode,
             convert_channels=args.convert_voltbin,
-            **input_factory_args
+            **input_factory_args,
         )
     elif input_type == "goes":
         # TODO: deal with other goes arguments
@@ -532,7 +532,15 @@ def get_input_factory(args):
             password=args.input_goes_password,
             server=args.input_goes_server,
             user=args.input_goes_user,
-            **input_factory_args
+            **input_factory_args,
+        )
+    elif input_type == "iris":
+        input_factory = edge.IRISFactory(
+            base_url=args.iris_url,
+            network=args.iris_network,
+            locationCode=args.locationcode,
+            convert_channels=args.convert_voltbin,
+            **input_factory_args,
         )
     else:
         # stream compatible factories
@@ -601,7 +609,7 @@ def get_output_factory(args):
             locationCode=locationcode,
             tag=args.output_edge_tag,
             forceout=args.output_edge_forceout,
-            **output_factory_args
+            **output_factory_args,
         )
     elif output_type == "miniseed":
         # TODO: deal with other miniseed arguments
@@ -611,7 +619,7 @@ def get_output_factory(args):
             port=args.output_read_port,
             write_port=args.output_port,
             locationCode=locationcode,
-            **output_factory_args
+            **output_factory_args,
         )
     elif output_type == "plot":
         output_factory = PlotTimeseriesFactory()
@@ -789,7 +797,16 @@ def parse_args(args):
     input_type_group = input_group.add_mutually_exclusive_group(required=True)
     input_type_group.add_argument(
         "--input",
-        choices=("edge", "goes", "iaga2002", "imfv122", "imfv283", "miniseed", "pcdcp"),
+        choices=(
+            "edge",
+            "goes",
+            "iaga2002",
+            "imfv122",
+            "imfv283",
+            "iris",
+            "miniseed",
+            "pcdcp",
+        ),
         default="edge",
         help='Input format (Default "edge")',
     )
@@ -854,6 +871,16 @@ def parse_args(args):
         help='Data interval, default "minute"',
         metavar="INTERVAL",
     )
+    input_group.add_argument(
+        "--iris-network",
+        default="NT",
+        help="data network",
+    )
+    input_group.add_argument(
+        "--iris-url",
+        default="http://service.iris.edu/irisws",
+        help="IRIS web service url",
+    )
     input_group.add_argument(
         "--locationcode",
         help="""
-- 
GitLab