Temporary fix for Auto/Manual Pick Dictionary detection + fix for .pha files not getting saved

This commit is contained in:
Jeldrik Gaal 2021-11-21 13:04:25 +01:00
parent 15cad42868
commit 131f6782af

View File

@ -573,6 +573,8 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
except KeyError as e: except KeyError as e:
print(str(e) + '; no weight set during processing') print(str(e) + '; no weight set during processing')
Ao = arrivals[key]['S']['Ao'] # peak-to-peak amplitude Ao = arrivals[key]['S']['Ao'] # peak-to-peak amplitude
if Ao == None:
Ao = 0.0
#fid.write('%s ? ? ? S %s %d%02d%02d %02d%02d %7.4f GAU 0 0 0 0 %d \n' % (key, #fid.write('%s ? ? ? S %s %d%02d%02d %02d%02d %7.4f GAU 0 0 0 0 %d \n' % (key,
fid.write('%s ? ? ? S %s %d%02d%02d %02d%02d %7.4f GAU 0 %9.2f 0 0 %d \n' % (key, fid.write('%s ? ? ? S %s %d%02d%02d %02d%02d %7.4f GAU 0 %9.2f 0 0 %d \n' % (key,
fm, fm,
@ -765,6 +767,8 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
arrivals = picksdict_from_picks(evt) arrivals = picksdict_from_picks(evt)
# check for automatic and manual picks # check for automatic and manual picks
# prefer manual picks # prefer manual picks
if len(arrivals.keys()) > 2:
arrivals = {'manual': {}, 'auto': arrivals}
if arrivals['auto'] and arrivals['manual']: if arrivals['auto'] and arrivals['manual']:
usedarrivals = arrivals['manual'] usedarrivals = arrivals['manual']
elif arrivals['auto']: elif arrivals['auto']:
@ -812,7 +816,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
print("No source origin calculated yet, thus no hypoDD-infile creation possible!") print("No source origin calculated yet, thus no hypoDD-infile creation possible!")
return return
stime = eventsource['time'] stime = eventsource['time']
event = parameter.get('eventID') event = eventinfo['pylot_id']
hddID = event.split('.')[0][1:5] hddID = event.split('.')[0][1:5]
# write header # write header
fid.write('# %d %d %d %d %d %5.2f %7.4f +%6.4f %7.4f %4.2f 0.1 0.5 %4.2f %s\n' % ( fid.write('# %d %d %d %d %d %5.2f %7.4f +%6.4f %7.4f %4.2f 0.1 0.5 %4.2f %s\n' % (
@ -827,6 +831,8 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
arrivals = picksdict_from_picks(evt) arrivals = picksdict_from_picks(evt)
# check for automatic and manual picks # check for automatic and manual picks
# prefer manual picks # prefer manual picks
if len(arrivals.keys()) > 2:
arrivals = {'manual': {}, 'auto': arrivals}
if arrivals['auto'] and arrivals['manual']: if arrivals['auto'] and arrivals['manual']:
usedarrivals = arrivals['manual'] usedarrivals = arrivals['manual']
elif arrivals['auto']: elif arrivals['auto']:
@ -883,6 +889,8 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
arrivals = picksdict_from_picks(evt) arrivals = picksdict_from_picks(evt)
# check for automatic and manual picks # check for automatic and manual picks
# prefer manual picks # prefer manual picks
if len(arrivals.keys()) > 2:
arrivals = {'manual': {}, 'auto': arrivals}
if arrivals['auto'] and arrivals['manual']: if arrivals['auto'] and arrivals['manual']:
usedarrivals = arrivals['manual'] usedarrivals = arrivals['manual']
elif arrivals['auto']: elif arrivals['auto']: