[bugfix] stream oabject overwritten when using alter_comp causing traces to disappear in plot

This commit is contained in:
Marcel Paffrath 2017-06-12 14:36:38 +02:00
parent 5412de8249
commit d2d8498739
2 changed files with 14 additions and 10 deletions

View File

@ -1 +1 @@
dded-dirty 5412-dirty

View File

@ -476,12 +476,14 @@ class WaveformWidgetPG(QtGui.QWidget):
alter_comp = compclass.getCompPosition(component) alter_comp = compclass.getCompPosition(component)
#alter_comp = str(alter_comp[0]) #alter_comp = str(alter_comp[0])
wfdata = wfdata.select(component=component) st_select = wfdata.select(component=component)
wfdata += wfdata.select(component=alter_comp) st_select += wfdata.select(component=alter_comp)
else:
st_select = wfdata
# list containing tuples of network, station, channel (for sorting) # list containing tuples of network, station, channel (for sorting)
nsc = [] nsc = []
for trace in wfdata: for trace in st_select:
nsc.append((trace.stats.network, trace.stats.station, trace.stats.channel)) nsc.append((trace.stats.network, trace.stats.station, trace.stats.channel))
nsc.sort() nsc.sort()
nsc.reverse() nsc.reverse()
@ -496,7 +498,7 @@ class WaveformWidgetPG(QtGui.QWidget):
print('Warning: Could not set zoom limits') print('Warning: Could not set zoom limits')
for n, (network, station, channel) in enumerate(nsc): for n, (network, station, channel) in enumerate(nsc):
st = wfdata.select(network=network, station=station, channel=channel) st = st_select.select(network=network, station=station, channel=channel)
trace = st[0] trace = st[0]
if mapping: if mapping:
comp = channel[-1] comp = channel[-1]
@ -623,18 +625,20 @@ class WaveformWidget(FigureCanvas):
alter_comp = compclass.getCompPosition(component) alter_comp = compclass.getCompPosition(component)
#alter_comp = str(alter_comp[0]) #alter_comp = str(alter_comp[0])
wfdata = wfdata.select(component=component) st_select = wfdata.select(component=component)
wfdata += wfdata.select(component=alter_comp) st_select += wfdata.select(component=alter_comp)
else:
st_select = wfdata
# list containing tuples of network, station, channel (for sorting) # list containing tuples of network, station, channel (for sorting)
nsc = [] nsc = []
for trace in wfdata: for trace in st_select:
nsc.append((trace.stats.network, trace.stats.station, trace.stats.channel)) nsc.append((trace.stats.network, trace.stats.station, trace.stats.channel))
nsc.sort() nsc.sort()
nsc.reverse() nsc.reverse()
for n, (network, station, channel) in enumerate(nsc): for n, (network, station, channel) in enumerate(nsc):
st = wfdata.select(network=network, station=station, channel=channel) st = st_select.select(network=network, station=station, channel=channel)
trace = st[0] trace = st[0]
if mapping: if mapping:
comp = channel[-1] comp = channel[-1]