[bugfix]/[improvement] handle station id lacking location, related to #266
Unpack depending on length of station id after split, if something unexpected happens, initialise with default values. This is related to https://ariadne.geophysik.ruhr-uni-bochum.de/trac/PyLoT/ticket/266. This should fix the missing station information in the title of the TuneAutopicker waveform plot.
This commit is contained in:
parent
f892225229
commit
f0e2fdb470
@ -3427,7 +3427,6 @@ class TuneAutopicker(QWidget):
|
|||||||
return str(self.stationBox.currentText()).split('.')[1]
|
return str(self.stationBox.currentText()).split('.')[1]
|
||||||
|
|
||||||
def get_current_station_id(self):
|
def get_current_station_id(self):
|
||||||
print(self.stationBox, self.stationBox.currentText())
|
|
||||||
return str(self.stationBox.currentText())
|
return str(self.stationBox.currentText())
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -3445,15 +3444,18 @@ class TuneAutopicker(QWidget):
|
|||||||
self.pdlg_widget = None
|
self.pdlg_widget = None
|
||||||
return
|
return
|
||||||
self.load_wf_data()
|
self.load_wf_data()
|
||||||
try:
|
station_id_list = self.get_current_station_id().split(".")
|
||||||
network, station, location, channel = self.get_current_station_id().split(".")
|
# this sometimes only contains network.station.
|
||||||
except ValueError as e:
|
if len(station_id_list) == 3:
|
||||||
# not enough values to unpack, initialize default values
|
# location is empty string
|
||||||
vmsg = '{0}'.format(e)
|
network, station, location = station_id_list
|
||||||
print(vmsg)
|
elif len(station_id_list) == 4:
|
||||||
|
# location contains text
|
||||||
|
network, station, location, _ = station_id_list
|
||||||
|
else:
|
||||||
station = self.get_current_station()
|
station = self.get_current_station()
|
||||||
location = None
|
|
||||||
network = None
|
network = None
|
||||||
|
location = None
|
||||||
|
|
||||||
wfdata = self.data.getWFData()
|
wfdata = self.data.getWFData()
|
||||||
metadata = self.parent().metadata
|
metadata = self.parent().metadata
|
||||||
|
Loading…
Reference in New Issue
Block a user