[cleanup] of autoPyLoT.py

This commit is contained in:
Darius Arnold 2017-10-05 17:26:18 +02:00
parent 3dde42e639
commit 9491a28710

View File

@ -87,7 +87,6 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
sp=sp_info) sp=sp_info)
print(splash) print(splash)
parameter = real_None(parameter) parameter = real_None(parameter)
inputfile = real_None(inputfile) inputfile = real_None(inputfile)
eventid = real_None(eventid) eventid = real_None(eventid)
@ -238,7 +237,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
# in autopylot.in # in autopylot.in
try: try:
parameter.get('eventID') parameter.get('eventID')
except: except Exception:
now = datetime.datetime.now() now = datetime.datetime.now()
eventID = '%d%02d%02d%02d%02d' % (now.year, eventID = '%d%02d%02d%02d%02d' % (now.year,
now.month, now.month,
@ -402,7 +401,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
iplot) iplot)
# update pick with moment property values (w0, fc, Mo) # update pick with moment property values (w0, fc, Mo)
for stats, props in moment_mag.moment_props.items(): for stats, props in moment_mag.moment_props.items():
if picks.has_key(stats): if stats in picks:
picks[stats]['P'].update(props) picks[stats]['P'].update(props)
evt = moment_mag.updated_event() evt = moment_mag.updated_event()
net_mw = moment_mag.net_magnitude() net_mw = moment_mag.net_magnitude()
@ -414,7 +413,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
parameter.get('sstop'), parameter.get('sstop'),
WAscaling, True, iplot) WAscaling, True, iplot)
for stats, amplitude in local_mag.amplitudes.items(): for stats, amplitude in local_mag.amplitudes.items():
if picks.has_key(stats): if stats in picks:
picks[stats]['S']['Ao'] = amplitude.generic_amplitude picks[stats]['S']['Ao'] = amplitude.generic_amplitude
print("Local station magnitudes scaled with:") print("Local station magnitudes scaled with:")
print("log(Ao) + %f * log(r) + %f * r + %f" % (WAscaling[0], print("log(Ao) + %f * log(r) + %f * r + %f" % (WAscaling[0],
@ -438,7 +437,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
data.applyEVTData(evt, 'event') data.applyEVTData(evt, 'event')
data.applyEVTData(picks) data.applyEVTData(picks)
if savexml: if savexml:
if savepath == 'None' or savepath == None: if savepath == 'None' or savepath is None:
saveEvtPath = eventpath saveEvtPath = eventpath
else: else:
saveEvtPath = savepath saveEvtPath = savepath