Not really fixed, but bypassed bug occuring when saving picks and no channel nor station coding is available.

This commit is contained in:
Ludger Küperkoch 2017-04-27 15:50:08 +02:00
parent d4dea0d356
commit 1b3fc717a6
4 changed files with 9 additions and 5 deletions

View File

@ -1 +1 @@
6b7d-dirty d4de-dirty

View File

@ -294,7 +294,6 @@ class Data(object):
:raise OverwriteError: raises an OverwriteError if the picks list is :raise OverwriteError: raises an OverwriteError if the picks list is
not empty. The GUI will then ask for a decision. not empty. The GUI will then ask for a decision.
""" """
#firstonset = find_firstonset(picks) #firstonset = find_firstonset(picks)
# check for automatic picks # check for automatic picks
print("Writing phases to ObsPy-quakeml file") print("Writing phases to ObsPy-quakeml file")

View File

@ -194,6 +194,7 @@ def picksdict_from_picks(evt):
for pick in evt.picks: for pick in evt.picks:
phase = {} phase = {}
station = pick.waveform_id.station_code station = pick.waveform_id.station_code
channel = pick.waveform_id.channel_code
try: try:
onsets = picks[station] onsets = picks[station]
except KeyError as e: except KeyError as e:
@ -213,6 +214,7 @@ def picksdict_from_picks(evt):
phase['epp'] = epp phase['epp'] = epp
phase['lpp'] = lpp phase['lpp'] = lpp
phase['spe'] = spe phase['spe'] = spe
phase['channel'] = channel
try: try:
picker = str(pick.method_id) picker = str(pick.method_id)
if picker.startswith('smi:local/'): if picker.startswith('smi:local/'):
@ -232,8 +234,11 @@ def picks_from_picksdict(picks, creation_info=None):
if not isinstance(phase, dict): if not isinstance(phase, dict):
continue continue
onset = phase['mpp'] onset = phase['mpp']
ccode = phase['channel'] try:
ncode = phase['network'] ccode = phase['channel']
ncode = phase['network']
except:
continue
pick = ope.Pick() pick = ope.Pick()
if creation_info: if creation_info:
pick.creation_info = creation_info pick.creation_info = creation_info