[bugfix] some (py3) related fixes in rotate station and minMax plotting

This commit is contained in:
Marcel Paffrath 2021-07-15 12:04:34 +02:00
parent aa73bb0ae8
commit cc1139d2ca
3 changed files with 13 additions and 7 deletions

View File

@ -3292,8 +3292,11 @@ class MainWindow(QMainWindow):
if event.magnitudes:
moment_magnitude = event.magnitudes[0]
moment_magnitude.mag = '%4.1f' % moment_magnitude.mag
local_magnitude = event.magnitudes[1]
local_magnitude.mag = '%4.1f' % local_magnitude.mag
if len(event.magnitudes) > 1:
local_magnitude = event.magnitudes[1]
local_magnitude.mag = '%4.1f' % local_magnitude.mag
else:
local_magnitude = moment_magnitude # MP MP small workaround in case there is no local magnitude, todo: improve this
item_momentmag.setText(str(moment_magnitude.mag))
item_localmag.setText(str(local_magnitude.mag))
item_notes.setText(event.notes)

View File

@ -950,10 +950,13 @@ def check4rotated(data, metadata=None, verbosity=1):
if any(rotation_required):
t_start = full_range(wfstream)
try:
azimuts = [metadata.get_coordinates(tr_id, t_start)['azimuth'] for tr_id in trace_ids]
dips = [metadata.get_coordinates(tr_id, t_start)['dip'] for tr_id in trace_ids]
azimuts = []
dips = []
for tr_id in trace_ids:
azimuts.append(metadata.get_coordinates(tr_id, t_start)['azimuth'])
dips.append(metadata.get_coordinates(tr_id, t_start)['dip'])
except (KeyError, TypeError) as e:
print('Failed to rotate trace {}, no azimuth or dip available in metadata'.format(trace_id))
print('Failed to rotate trace {}, no azimuth or dip available in metadata'.format(tr_id))
return wfstream
if len(wfstream) < 3:
print('Failed to rotate Stream {}, not enough components available.'.format(wfstream))

View File

@ -719,7 +719,7 @@ class WaveformWidgetPG(QtWidgets.QWidget):
station = self.orig_parent.getTraceID(wfID)
abstime = self.wfstart + x
if self.orig_parent.get_current_event():
self.status_label.setText("station = {}, T = {}, t = {} [s], sampling rate = ".format(station, abstime, x))
self.status_label.setText("station = {}, T = {}, t = {} [s]".format(station, abstime, x))
self.vLine.setPos(mousePoint.x())
self.hLine.setPos(mousePoint.y())
@ -895,7 +895,7 @@ class WaveformWidgetPG(QtWidgets.QWidget):
'''
npixel = self.orig_parent.width()
ndata = len(trace.data)
pts_per_pixel = ndata / npixel
pts_per_pixel = ndata // npixel
if pts_per_pixel < 2:
return trace.data, time_ax
remaining_samples = ndata % pts_per_pixel