From 0c4085ed760864630ac7003beb253721bd179edd Mon Sep 17 00:00:00 2001 From: Darius Arnold Date: Fri, 3 Aug 2018 13:50:14 +0200 Subject: [PATCH] [bugfix] station name was in dictionary instead of a list item for autopickstations return value Old implementation of autopickstation returned a list containing a dcitionary with results as a first value and a string with the station name as a second value. The new version used to return a single dict with a key/value station name pair, which the calling code could not unpack. The new implementation now also returns a list with picking results and station name. --- pylot/core/pick/autopick.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index 4dd5de87..2866c39f 100644 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -553,7 +553,7 @@ class AutopickStation(object): self.plot_pick_results() self.finish_picking() - return {'P': self.p_results, 'S':self.s_results, 'station':self.ztrace.stats.station} + return [{'P': self.p_results, 'S':self.s_results}, self.ztrace.stats.station] def finish_picking(self): @@ -1165,7 +1165,11 @@ def autopickstation(wfstream, pickparam, verbose=False, iplot=0, fig_dict=None, except MissingTraceException as e: # Either vertical or both horizontal traces are missing print(e) - return None + try: + station_name = wfstream[0].stats.station + except IndexError: + station_name = 'None' + return None, station_name def nautopickstation(wfstream, pickparam, verbose=False,