Skip to content

Commit 2d4672e

Browse files
committed
updated script args for server settings
1 parent e1b2610 commit 2d4672e

File tree

3 files changed

+176
-128
lines changed

3 files changed

+176
-128
lines changed

Diff for: docs/atacr.rst

+56-29
Original file line numberDiff line numberDiff line change
@@ -251,20 +251,28 @@ Usage
251251
Server Settings:
252252
Settings associated with which datacenter to log into.
253253
254-
-S SERVER, --server SERVER
255-
Specify the server to connect to. Options include:
256-
BGR, ETH, GEONET, GFZ, INGV, IPGP, IRIS, KOERI, LMU,
257-
NCEDC, NEIP, NERIES, ODC, ORFEUS, RESIF, SCEDC, USGS,
258-
USP. [Default IRIS]
259-
--server-url SERVER_URL
260-
Specify the obspy base_url server address (and port if
261-
needed) to open for the fdsn client. Overrides any
262-
settings to '--server'. [Default None]
263-
-U USERAUTH, --user-auth USERAUTH
264-
Enter your Authentification Username and Password
265-
(--user-auth='username:authpassword') to access and
266-
download restricted data. [Default no user and
267-
password]
254+
--server SERVER Base URL of FDSN web service compatible server (e.g.
255+
“http://service.iris.edu”) or key string for
256+
recognized server (one of 'AUSPASS', 'BGR',
257+
'EARTHSCOPE', 'EIDA', 'EMSC', 'ETH', 'GEOFON',
258+
'GEONET', 'GFZ', 'ICGC', 'IESDMC', 'INGV', 'IPGP',
259+
'IRIS', 'IRISPH5', 'ISC', 'KNMI', 'KOERI', 'LMU',
260+
'NCEDC', 'NIEP', 'NOA', 'NRCAN', 'ODC', 'ORFEUS',
261+
'RASPISHAKE', 'RESIF', 'RESIFPH5', 'SCEDC', 'TEXNET',
262+
'UIB-NORSAR', 'USGS', 'USP'). [Default 'IRIS']
263+
--user-auth USERAUTH Authentification Username and Password for the
264+
waveform server (--user-auth='username:authpassword')
265+
to access and download restricted data. [Default no
266+
user and password]
267+
--eida-token TOKENFILE
268+
Token for EIDA authentication mechanism, see
269+
http://geofon.gfz-
270+
potsdam.de/waveform/archive/auth/index.php. If a token
271+
is provided, argument --user-auth will be ignored.
272+
This mechanism is only available on select EIDA nodes.
273+
The token can be provided in form of the PGP message
274+
as a string, or the filename of a local file with the
275+
PGP message in it. [Default None]
268276
269277
Frequency Settings:
270278
Miscellaneous frequency settings
@@ -586,21 +594,40 @@ Usage
586594
Server Settings:
587595
Settings associated with which datacenter to log into.
588596
589-
-S SERVER, --server SERVER
590-
Specify the server to connect to. Options include:
591-
BGR, ETH, GEONET, GFZ, INGV, IPGP, IRIS, KOERI, LMU,
592-
NCEDC, NEIP, NERIES, ODC, ORFEUS, RESIF, SCEDC, USGS,
593-
USP. [Default IRIS]
594-
--server-url SERVER_URL
595-
Specify the obspy base_url server address (and port if
596-
needed) to open for the fdsn client. Overrides any
597-
settings to '--server'. [Default None]
598-
-U USERAUTH, --user-auth USERAUTH
599-
Enter your Authentification Username and Password
600-
(--user-auth='username:authpassword') to access and
601-
download restricted data. [Default no user and
602-
password]
603-
597+
--server-cat SERVER_CAT
598+
Catalogue server setting: Key string for recognized
599+
server that provide `available_event_catalogs` service
600+
(one of 'AUSPASS', 'BGR', 'EARTHSCOPE', 'EIDA',
601+
'EMSC', 'ETH', 'GEOFON', 'GEONET', 'GFZ', 'ICGC',
602+
'IESDMC', 'INGV', 'IPGP', 'IRIS', 'IRISPH5', 'ISC',
603+
'KNMI', 'KOERI', 'LMU', 'NCEDC', 'NIEP', 'NOA',
604+
'NRCAN', 'ODC', 'ORFEUS', 'RASPISHAKE', 'RESIF',
605+
'RESIFPH5', 'SCEDC', 'TEXNET', 'UIB-NORSAR', 'USGS',
606+
'USP'). [Default 'IRIS']
607+
--server-wf SERVER_WF
608+
Waveform server setting: Base URL of FDSN web service
609+
compatible server (e.g. “http://service.iris.edu”) or
610+
key string for recognized server (one of 'AUSPASS',
611+
'BGR', 'EARTHSCOPE', 'EIDA', 'EMSC', 'ETH', 'GEOFON',
612+
'GEONET', 'GFZ', 'ICGC', 'IESDMC', 'INGV', 'IPGP',
613+
'IRIS', 'IRISPH5', 'ISC', 'KNMI', 'KOERI', 'LMU',
614+
'NCEDC', 'NIEP', 'NOA', 'NRCAN', 'ODC', 'ORFEUS',
615+
'RASPISHAKE', 'RESIF', 'RESIFPH5', 'SCEDC', 'TEXNET',
616+
'UIB-NORSAR', 'USGS', 'USP'). [Default 'IRIS']
617+
--user-auth USERAUTH Authentification Username and Password for the
618+
waveform server (--user-auth='username:authpassword')
619+
to access and download restricted data. [Default no
620+
user and password]
621+
--eida-token TOKENFILE
622+
Token for EIDA authentication mechanism, see
623+
http://geofon.gfz-
624+
potsdam.de/waveform/archive/auth/index.php. If a token
625+
is provided, argument --user-auth will be ignored.
626+
This mechanism is only available on select EIDA nodes.
627+
The token can be provided in form of the PGP message
628+
as a string, or the filename of a local file with the
629+
PGP message in it. [Default None]
630+
604631
Frequency Settings:
605632
Miscellaneous frequency settings
606633

Diff for: obstools/scripts/atacr_download_data.py

+53-50
Original file line numberDiff line numberDiff line change
@@ -109,33 +109,39 @@ def get_daylong_arguments(argv=None):
109109
description="Settings associated with which "
110110
"datacenter to log into.")
111111
ServerGroup.add_argument(
112-
"-S", "--server",
112+
"--server",
113113
action="store",
114114
type=str,
115115
dest="server",
116116
default="IRIS",
117-
help="Specify the server to connect to. Options include: " +
118-
"BGR, ETH, GEONET, GFZ, INGV, IPGP, IRIS, KOERI, LMU, NCEDC, " +
119-
"NEIP, NERIES, ODC, ORFEUS, RESIF, SCEDC, USGS, USP. " +
120-
"[Default IRIS]")
117+
help="Base URL of FDSN web service compatible "
118+
"server (e.g. “http://service.iris.edu”) or key string for recognized "
119+
"server (one of 'AUSPASS', 'BGR', 'EARTHSCOPE', 'EIDA', 'EMSC', 'ETH', "
120+
"'GEOFON', 'GEONET', 'GFZ', 'ICGC', 'IESDMC', 'INGV', 'IPGP', 'IRIS', "
121+
"'IRISPH5', 'ISC', 'KNMI', 'KOERI', 'LMU', 'NCEDC', 'NIEP', 'NOA', "
122+
"'NRCAN', 'ODC', 'ORFEUS', 'RASPISHAKE', 'RESIF', 'RESIFPH5', 'SCEDC', "
123+
"'TEXNET', 'UIB-NORSAR', 'USGS', 'USP'). [Default 'IRIS']")
121124
ServerGroup.add_argument(
122-
"--server-url",
125+
"--user-auth",
123126
action="store",
124127
type=str,
125-
dest="server_url",
128+
dest="userauth",
126129
default=None,
127-
help="Specify the obspy base_url server address (and port if needed) " +
128-
"to open for the fdsn client. Overrides any settings to '--server'. " +
129-
"[Default None]")
130+
help="Authentification Username and Password for the " +
131+
"waveform server (--user-auth='username:authpassword') to access " +
132+
"and download restricted data. [Default no user and password]")
130133
ServerGroup.add_argument(
131-
"-U", "--user-auth",
132-
action="store",
134+
"--eida-token",
135+
action="store",
133136
type=str,
134-
dest="userauth",
135-
default="",
136-
help="Enter your Authentification Username and Password " +
137-
"(--user-auth='username:authpassword') to access and download " +
138-
"restricted data. [Default no user and password]")
137+
dest="tokenfile",
138+
default=None,
139+
help="Token for EIDA authentication mechanism, see " +
140+
"http://geofon.gfz-potsdam.de/waveform/archive/auth/index.php. "
141+
"If a token is provided, argument --user-auth will be ignored. "
142+
"This mechanism is only available on select EIDA nodes. The token can "
143+
"be provided in form of the PGP message as a string, or the filename of "
144+
"a local file with the PGP message in it. [Default None]")
139145

140146
"""
141147
# Database Settings
@@ -258,17 +264,20 @@ def get_daylong_arguments(argv=None):
258264
else:
259265
args.endT = None
260266

261-
# Parse User Authentification
262-
if not len(args.userauth) == 0:
263-
tt = args.userauth.split(':')
264-
if not len(tt) == 2:
265-
parser.error(
266-
"Error: Incorrect Username and Password Strings for " +
267-
"User Authentification")
268-
else:
269-
args.userauth = tt
267+
# Parse restricted data settings
268+
if args.tokenfile is not None:
269+
args.userauth = [None, None]
270270
else:
271-
args.userauth = []
271+
if args.userauth is not None:
272+
tt = args.userauth.split(':')
273+
if not len(tt) == 2:
274+
msg = ("Error: Incorrect Username and Password Strings for User "
275+
"Authentification")
276+
parser.error(msg)
277+
else:
278+
args.userauth = tt
279+
else:
280+
args.userauth = [None, None]
272281

273282
# # Parse Local Data directories
274283
# if args.localdata is not None:
@@ -283,17 +292,19 @@ def get_daylong_arguments(argv=None):
283292
# args.ndval = nan
284293

285294
if args.units not in ['DISP', 'VEL', 'ACC']:
286-
raise(Exception(
287-
"Error: invalid --units argument. Choose among " +
288-
"'DISP', 'VEL', or 'ACC'"))
295+
msg = ("Error: invalid --units argument. Choose among "
296+
"'DISP', 'VEL', or 'ACC'")
297+
parser.error(msg)
298+
289299
if args.pre_filt is None:
290300
args.pre_filt = [0.001, 0.005, 45., 50.]
291301
else:
292302
args.pre_filt = [float(val) for val in args.pre_filt.split(',')]
293303
args.pre_filt = sorted(args.pre_filt)
294304
if (len(args.pre_filt)) != 4:
295-
raise(Exception(
296-
"Error: --pre-filt should contain 4 comma-separated floats"))
305+
msg = ("Error: --pre-filt should contain 4 "
306+
"comma-separated floats")
307+
parser.error(msg)
297308

298309
return args
299310

@@ -339,24 +350,16 @@ def main(args=None):
339350
datapath.mkdir(parents=True)
340351

341352
# Establish client
342-
if len(args.userauth) == 0:
343-
if args.server_url is not None:
344-
client = Client(
345-
base_url=args.server_url)
346-
else:
347-
client = Client(
348-
args.server)
349-
else:
350-
if args.server_url is not None:
351-
client = Client(
352-
base_url=args.server_url,
353-
user=args.userauth[0],
354-
password=args.userauth[1])
355-
else:
356-
client = Client(
357-
args.server,
358-
user=args.userauth[0],
359-
password=args.userauth[1])
353+
if args.verb > 1:
354+
print(" Establishing Client...")
355+
client = Client(
356+
base_url=args.server,
357+
user=args.userauth[0],
358+
password=args.userauth[1],
359+
eida_token=args.tokenfile)
360+
if args.verb > 1:
361+
print(" Done")
362+
print(" ")
360363

361364
# Get catalogue search start time
362365
if args.startT is None:

0 commit comments

Comments
 (0)