[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.
This commit is contained in:
Darius Arnold 2018-08-03 13:50:14 +02:00
parent 2b9cf655ae
commit 0c4085ed76

View File

@ -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,