Exception for ValueError, if autoPyLoT has been started from terminal.
Raise SacIOError if obspy.read spuriously wants to read SAC data.
This commit is contained in:
parent
0fb6e5d4df
commit
e2c1b8501e
28
autoPyLoT.py
28
autoPyLoT.py
@ -357,8 +357,15 @@ if __name__ == "__main__":
|
||||
# parse arguments
|
||||
parser = argparse.ArgumentParser(
|
||||
description='''autoPyLoT automatically picks phase onset times using higher order statistics,
|
||||
autoregressive prediction and AIC''')
|
||||
autoregressive prediction and AIC followed by locating the seismic events using
|
||||
NLLoc''')
|
||||
|
||||
#parser.add_argument('-d', '-D', '--input_dict', type=str,
|
||||
# action='store',
|
||||
# help='''optional, dictionary containing processing parameters''')
|
||||
#parser.add_argument('-p', '-P', '--parameter', type=str,
|
||||
# action='store',
|
||||
# help='''parameter file, default=None''')
|
||||
parser.add_argument('-i', '-I', '--inputfile', type=str,
|
||||
action='store',
|
||||
help='''full path to the file containing the input
|
||||
@ -369,17 +376,18 @@ if __name__ == "__main__":
|
||||
parser.add_argument('-e', '-E', '--eventid', type=str,
|
||||
action='store',
|
||||
help='''optional, event path incl. event ID''')
|
||||
# parser.add_argument('-p', '-P', '--plot', action='store',
|
||||
# help='show interactive plots')
|
||||
parser.add_argument('-s', '-S', '--spath', type=str,
|
||||
action='store',
|
||||
help='''optional, save path for autoPyLoT output''')
|
||||
parser.add_argument('-v', '-V', '--version', action='version',
|
||||
version='autoPyLoT ' + __version__,
|
||||
help='show version information and exit')
|
||||
#parser.add_argument('-v', '-V', '--version', action='version',
|
||||
# version='autoPyLoT ' + __version__,
|
||||
# help='show version information and exit')
|
||||
|
||||
cla = parser.parse_args()
|
||||
|
||||
picks, mainFig = autoPyLoT(inputfile=str(cla.inputfile),
|
||||
fnames=str(cla.fnames), eventid=str(cla.eventid),
|
||||
savepath=str(cla.spath))
|
||||
|
||||
try:
|
||||
picks, mainFig = autoPyLoT(inputfile=str(cla.inputfile), fnames=str(cla.fnames),
|
||||
eventid=str(cla.eventid), savepath=str(cla.spath))
|
||||
except ValueError:
|
||||
print("autoPyLoT was running in production mode.")
|
||||
|
||||
|
@ -5,6 +5,7 @@ import copy
|
||||
import os
|
||||
from obspy import read_events
|
||||
from obspy.core import read, Stream, UTCDateTime
|
||||
from obspy.io.sac import SacIOError
|
||||
from obspy.core.event import Event
|
||||
from pylot.core.io.phases import readPILOTEvent, picks_from_picksdict, \
|
||||
picksdict_from_pilot, merge_picks
|
||||
@ -230,6 +231,8 @@ class Data(object):
|
||||
self.wfdata += read(fname, format='GSE2')
|
||||
except Exception as e:
|
||||
warnmsg += '{0}\n{1}\n'.format(fname, e)
|
||||
except SacIOError as se:
|
||||
warnmsg += '{0}\n{1}\n'.format(fname, se)
|
||||
if warnmsg:
|
||||
warnmsg = 'WARNING: unable to read\n' + warnmsg
|
||||
print(warnmsg)
|
||||
|
Loading…
Reference in New Issue
Block a user