[addresses #190, closes #192] handles unknown picker information

pick tag is set to 'Unknown' for loaded data that do not provide picker information when saved with PyLoT prior to revision 06576586c6
This commit is contained in:
Sebastian Wehling-Benatelli 2016-03-29 08:24:32 +02:00
parent cee48146d0
commit 4c5b58dbf1

View File

@ -3,6 +3,7 @@
import os import os
import glob import glob
import warnings
from obspy.io.xseed import Parser from obspy.io.xseed import Parser
from obspy.core import read, Stream, UTCDateTime from obspy.core import read, Stream, UTCDateTime
from obspy import read_events, read_inventory from obspy import read_events, read_inventory
@ -421,7 +422,11 @@ class Data(object):
epp = phase['epp'] epp = phase['epp']
lpp = phase['lpp'] lpp = phase['lpp']
error = phase['spe'] error = phase['spe']
picker = phase['picker'] try:
picker = phase['picker']
except KeyError as e:
warnings.warn(str(e), Warning)
picker = 'Unknown'
pick = Pick() pick = Pick()
pick.time = onset pick.time = onset
pick.time_errors.lower_uncertainty = onset - epp pick.time_errors.lower_uncertainty = onset - epp