[bugfix] various, pick delete/plot behaviour

This commit is contained in:
Marcel Paffrath 2018-07-18 14:12:59 +02:00
parent 12082cb2a9
commit 90e26cbd8f
7 changed files with 28 additions and 20 deletions

View File

@ -2669,6 +2669,16 @@ class MainWindow(QMainWindow):
self.drawPicks(station, picktype=picktype, stime=stime)
return
if self.pg:
pw = self.getPlotWidget().plotWidget
else:
ax = self.getPlotWidget().axes[0]
if station in self.drawnPicks[picktype].keys():
for item in self.drawnPicks[picktype][station]:
pw.removeItem(item)
self.drawnPicks[picktype][station] = []
# check for station key in dictionary, else return
if not station in self.getPicks(type=picktype):
return
@ -2677,19 +2687,10 @@ class MainWindow(QMainWindow):
plotID = self.getStationID(station)
if plotID is None:
return
if self.pg:
pw = self.getPlotWidget().plotWidget
else:
ax = self.getPlotWidget().axes[0]
ylims = np.array([-.5, +.5]) + plotID
stat_picks = self.getPicks(type=picktype)[station]
if station in self.drawnPicks[picktype].keys():
for item in self.drawnPicks[picktype][station]:
pw.removeItem(item)
self.drawnPicks[picktype][station] = []
for phase in stat_picks:
if phase == 'SPt': continue # wadati SP time
picks = stat_picks[phase]

View File

@ -271,7 +271,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
if not wfdat:
print('Could not find station {}. STOP!'.format(station))
return
wfdat = remove_underscores(wfdat)
#wfdat = remove_underscores(wfdat)
# trim components for each station to avoid problems with different trace starttimes for one station
wfdat = check4gaps(wfdat)
wfdat = check4doubled(wfdat)

View File

@ -405,7 +405,7 @@ class Data(object):
# various pre-processing steps:
# remove possible underscores in station names
self.wfdata = remove_underscores(self.wfdata)
#self.wfdata = remove_underscores(self.wfdata)
# check for stations with rotated components
if checkRotated and metadata is not None:
self.wfdata = check4rotated(self.wfdata, metadata, verbosity=0)

View File

@ -580,7 +580,7 @@ def restitute_data(data, metadata, unit='VEL', force=False, ncores=0):
restflag = list()
data = remove_underscores(data)
#data = remove_underscores(data)
# loop over traces
input_tuples = []

View File

@ -185,7 +185,8 @@ class Event(ObsPyEvent):
self.pylot_picks[station] = pick
else:
try:
self.pylot_picks.pop(station)
if station in self.pylot_picks:
self.pylot_picks.pop(station)
except Exception as e:
print('Could not remove pick {} from station {}: {}'.format(pick, station, e))
self.clearObsPyPicks('manual')
@ -236,7 +237,8 @@ class Event(ObsPyEvent):
self.pylot_autopicks[station] = pick
else:
try:
self.pylot_autopicks.pop(station)
if station in self.pylot_autopicks:
self.pylot_autopicks.pop(station)
except Exception as e:
print('Could not remove pick {} from station {}: {}'.format(pick, station, e))
self.clearObsPyPicks('auto')

View File

@ -399,6 +399,10 @@ def full_range(stream):
:return: minimum start time and maximum end time
:rtype: (`~maximum start time and minimum end time`, maximum start time and minimum end time)
"""
if not stream:
print('full_range: Empty Stream!')
return None, None
min_start = min([trace.stats.starttime for trace in stream])
max_end = max([trace.stats.endtime for trace in stream])
@ -831,9 +835,9 @@ def remove_underscores(data):
:return: data stream
:rtype: `~obspy.core.stream.Stream`
"""
for tr in data:
# remove underscores
tr.stats.station = tr.stats.station.strip('_')
#for tr in data:
# # remove underscores
# tr.stats.station = tr.stats.station.strip('_')
return data

View File

@ -2525,8 +2525,9 @@ class PickDlg(QDialog):
if phase in self.phaseLines.keys():
del (self.phaseLines[phase])
# information output
msg = 'Deleted {} pick for phase {}, at timestamp {} (relative time: {} s)'
print(msg.format(picktype, phase, self.getStartTime() + pick_rel, pick_rel))
msg = 'Deleted {} pick for phase {}, station {} at timestamp {} (relative time: {} s)'
print(msg.format(picktype, phase, '{}.{}'.format(self.network, self.station),
self.getStartTime() + pick_rel, pick_rel))
self.setDirty(True)
def identify_selected_picks(self, x):
@ -3167,7 +3168,7 @@ class TuneAutopicker(QWidget):
self.data.setWFData(fnames)
wfdat = self.data.getWFData() # all available streams
# remove possible underscores in station names
wfdat = remove_underscores(wfdat)
#wfdat = remove_underscores(wfdat)
# rotate misaligned stations to ZNE
# check for gaps and doubled channels
check4gaps(wfdat)