[update] changed sorting of traces overview if all station names are numeric (e.g. active experiments)

This commit is contained in:
Marcel Paffrath 2024-04-09 15:53:19 +02:00
parent f03ace75e7
commit 8b95c7a0fe

View File

@ -860,13 +860,26 @@ class WaveformWidgetPG(QtWidgets.QWidget):
def clearPlotDict(self): def clearPlotDict(self):
self.plotdict = dict() self.plotdict = dict()
def plotWFData(self, wfdata, wfsyn=None, title=None, zoomx=None, zoomy=None, def plotWFData(self, wfdata, wfsyn=None, title=None, scaleddata=False, mapping=True,
noiselevel=None, scaleddata=False, mapping=True, component='*', nth_sample=1, verbosity=0, method='normal', gain=1., shift_syn=0.2):
component='*', nth_sample=1, iniPick=None, verbosity=0, def station_sort(nslc):
method='normal', gain=1.): """Try to sort after station integer in case of a line array (e.g. active seismics)"""
try:
rval = sorted(nslc, key=lambda x: int(x.split('.')[1]))
return rval
except ValueError as e:
# this is the standard case for seismological stations
pass
except Exception as e:
print(f'Sorting by station integer failed with unknown exception: {e}')
# fallback to default sorting
return sorted(nslc)
if not wfdata: if not wfdata:
print('Nothing to plot.') print('Nothing to plot.')
return return
self.title = title self.title = title
self.clearPlotDict() self.clearPlotDict()
self.wfstart, self.wfend = full_range(wfdata) self.wfstart, self.wfend = full_range(wfdata)
@ -891,7 +904,7 @@ class WaveformWidgetPG(QtWidgets.QWidget):
for trace in st_select: for trace in st_select:
nslc.append( nslc.append(
trace.get_id()) # (trace.stats.network, trace.stats.station, trace.stats.location trace.stats.channel)) trace.get_id()) # (trace.stats.network, trace.stats.station, trace.stats.location trace.stats.channel))
nslc.sort() nslc = station_sort(nslc)
nslc.reverse() nslc.reverse()
plots = [] plots = []