From 1b3fc717a698ba4e0e4e8f9779ec0fbd4718bf29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Thu, 27 Apr 2017 15:50:08 +0200 Subject: [PATCH] Not really fixed, but bypassed bug occuring when saving picks and no channel nor station coding is available. --- pylot/RELEASE-VERSION | 2 +- pylot/core/io/data.py | 1 - pylot/core/io/location.py | 2 +- pylot/core/io/phases.py | 9 +++++++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pylot/RELEASE-VERSION b/pylot/RELEASE-VERSION index c6a4ec44..b110a26e 100644 --- a/pylot/RELEASE-VERSION +++ b/pylot/RELEASE-VERSION @@ -1 +1 @@ -6b7d-dirty +d4de-dirty diff --git a/pylot/core/io/data.py b/pylot/core/io/data.py index 5aa8613a..edc8bbbc 100644 --- a/pylot/core/io/data.py +++ b/pylot/core/io/data.py @@ -294,7 +294,6 @@ class Data(object): :raise OverwriteError: raises an OverwriteError if the picks list is not empty. The GUI will then ask for a decision. """ - #firstonset = find_firstonset(picks) # check for automatic picks print("Writing phases to ObsPy-quakeml file") diff --git a/pylot/core/io/location.py b/pylot/core/io/location.py index 157321a8..d7ee26d8 100644 --- a/pylot/core/io/location.py +++ b/pylot/core/io/location.py @@ -217,4 +217,4 @@ def create_resourceID(timetohash, restype, authority_id=None, hrstr=None): resID = ope.ResourceIdentifier(restype + '/' + hrstr) if authority_id is not None: resID.convertIDToQuakeMLURI(authority_id=authority_id) - return resID \ No newline at end of file + return resID diff --git a/pylot/core/io/phases.py b/pylot/core/io/phases.py index 3e86dc23..dc9ffce2 100644 --- a/pylot/core/io/phases.py +++ b/pylot/core/io/phases.py @@ -194,6 +194,7 @@ def picksdict_from_picks(evt): for pick in evt.picks: phase = {} station = pick.waveform_id.station_code + channel = pick.waveform_id.channel_code try: onsets = picks[station] except KeyError as e: @@ -213,6 +214,7 @@ def picksdict_from_picks(evt): phase['epp'] = epp phase['lpp'] = lpp phase['spe'] = spe + phase['channel'] = channel try: picker = str(pick.method_id) if picker.startswith('smi:local/'): @@ -232,8 +234,11 @@ def picks_from_picksdict(picks, creation_info=None): if not isinstance(phase, dict): continue onset = phase['mpp'] - ccode = phase['channel'] - ncode = phase['network'] + try: + ccode = phase['channel'] + ncode = phase['network'] + except: + continue pick = ope.Pick() if creation_info: pick.creation_info = creation_info