Skip to content
Snippets Groups Projects
Commit 216de5fa authored by Hal Simpson's avatar Hal Simpson
Browse files

moved I/O & algorithm specific parser arguments to their individual Factory's/Algorithms.

parent 7e25bdba
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,9 @@ from geomagio.Algorithm import Algorithm ...@@ -17,6 +17,9 @@ from geomagio.Algorithm import Algorithm
from geomagio.XYZAlgorithm import XYZAlgorithm from geomagio.XYZAlgorithm import XYZAlgorithm
from geomagio.Controller import Controller from geomagio.Controller import Controller
from geomagio.iaga2002.IAGA2002Factory import IAGA_FILE_PATTERN from geomagio.iaga2002.IAGA2002Factory import IAGA_FILE_PATTERN
from geomagio.iaga2002.IAGA2002Factory import iaga_add_parse_arguments
from geomagio.XYZAlgorithm import XYZAlgorithm_add_parse_arguments
from geomagio.edge.EdgeFactory import edge_add_parse_arguments
from obspy.core.utcdatetime import UTCDateTime from obspy.core.utcdatetime import UTCDateTime
...@@ -137,48 +140,12 @@ def parse_args(): ...@@ -137,48 +140,12 @@ def parse_args():
parser.add_argument('--interval', default='minute', parser.add_argument('--interval', default='minute',
choices=['minute', 'second']) choices=['minute', 'second'])
parser.add_argument('--algorithm', choices='xyz') parser.add_argument('--algorithm', choices=['xyz', ])
# xyz algorithm arguments # Add I/O and Algorithm specific arguments
parser.add_argument('--xyz-informat', iaga_add_parse_arguments(parser)
choices=['geo', 'mag', 'obs', 'obsd']) edge_add_parse_arguments(parser)
parser.add_argument('--xyz-outformat', XYZAlgorithm_add_parse_arguments(parser)
choices=['geo', 'mag', 'obs', 'obsd'])
# iaga2002 input arguments
parser.add_argument('--input-iaga-file',
help='Iaga2002 filename')
parser.add_argument('--input-iaga-magweb',
action="store_true", default=False,
help='Indicates iaga2002 files will be read from \
http://magweb.cr.usgs.gov/data/magnetometer/')
parser.add_argument('--input-iaga-stdin',
action="store_true", default=False,
help='Indicates file will be redirected from stdin')
parser.add_argument('--input-iaga-url',
help='Url or Directory where Iaga2002 files can be read from')
parser.add_argument('--input-iaga-urltemplate',
help='Template for directory matching')
parser.add_argument('--input-iaga-filetemplate',
help='Template for iaga filenames')
parser.add_argument('--output-iaga-url',
help='Url or Directory where IAGA2002 files should be written to')
parser.add_argument('--output-iaga-stdout',
action="store_true", default=False,
help='Indicates file will be directed to stdout')
parser.add_argument('--output-iaga-urltemplate',
help='Template for subdirectories')
parser.add_argument('--output-iaga-filetemplate',
help='Template for iaga filenames')
parser.add_argument('--output-iaga-file',
help='Output file name for single iaga file.')
# Edge input arguments
parser.add_argument('--input-edge-host',
help='ip address of the edge input server')
parser.add_argument('--input-edge-port', type=int,
help='port number of the edge input server')
return parser.parse_args() return parser.parse_args()
......
...@@ -19,6 +19,19 @@ CHANNELS = { ...@@ -19,6 +19,19 @@ CHANNELS = {
} }
def XYZAlgorithm_add_parse_arguments(parser):
"""add XYZ specific arguments to parser
Parameters
----------
parser: argparse.ArgumentParser
"""
parser.add_argument('--xyz-informat',
choices=['geo', 'mag', 'obs', 'obsd'])
parser.add_argument('--xyz-outformat',
choices=['geo', 'mag', 'obs', 'obsd'])
class XYZAlgorithm(Algorithm): class XYZAlgorithm(Algorithm):
"""Algorithm for converting data, probably inapproprately named XYZ. """Algorithm for converting data, probably inapproprately named XYZ.
......
...@@ -17,6 +17,19 @@ from obspy import earthworm ...@@ -17,6 +17,19 @@ from obspy import earthworm
from ObservatoryMetadata import ObservatoryMetadata from ObservatoryMetadata import ObservatoryMetadata
def edge_add_parse_arguments(parser):
"""add edge specific arguments to parser
Parameters
----------
parser: argparse.ArgumentParser
"""
parser.add_argument('--input-edge-host',
help='ip address of the edge input server')
parser.add_argument('--input-edge-port', type=int,
help='port number of the edge input server')
class EdgeFactory(TimeseriesFactory): class EdgeFactory(TimeseriesFactory):
"""TimeseriesFactory for Edge related data. """TimeseriesFactory for Edge related data.
......
...@@ -43,6 +43,42 @@ def read_url(url): ...@@ -43,6 +43,42 @@ def read_url(url):
return content return content
def iaga_add_parse_arguments(parser):
"""add iaga2002 specific arguments to parser
Parameters
----------
parser: argparse.ArgumentParser
"""
parser.add_argument('--input-iaga-file',
help='Iaga2002 filename')
parser.add_argument('--input-iaga-magweb',
action="store_true", default=False,
help='Indicates iaga2002 files will be read from \
http://magweb.cr.usgs.gov/data/magnetometer/')
parser.add_argument('--input-iaga-stdin',
action="store_true", default=False,
help='Indicates file will be redirected from stdin')
parser.add_argument('--input-iaga-url',
help='Url or Directory where Iaga2002 files can be read from')
parser.add_argument('--input-iaga-urltemplate',
help='Template for directory matching')
parser.add_argument('--input-iaga-filetemplate',
help='Template for iaga filenames')
parser.add_argument('--output-iaga-url',
help='Url or Directory where IAGA2002 files should be written to')
parser.add_argument('--output-iaga-stdout',
action="store_true", default=False,
help='Indicates file will be directed to stdout')
parser.add_argument('--output-iaga-urltemplate',
help='Template for subdirectories')
parser.add_argument('--output-iaga-filetemplate',
help='Template for iaga filenames')
parser.add_argument('--output-iaga-file',
help='Output file name for single iaga file.')
class IAGA2002Factory(TimeseriesFactory): class IAGA2002Factory(TimeseriesFactory):
"""TimeseriesFactory for IAGA 2002 formatted files. """TimeseriesFactory for IAGA 2002 formatted files.
......
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