feature/port-to-py3 #11

Merged
marcel merged 59 commits from feature/port-to-py3 into develop 2022-03-21 15:30:06 +01:00
3 changed files with 13 additions and 7 deletions
Showing only changes of commit cc1139d2ca - Show all commits

View File

@ -3292,8 +3292,11 @@ class MainWindow(QMainWindow):
if event.magnitudes: if event.magnitudes:
moment_magnitude = event.magnitudes[0] moment_magnitude = event.magnitudes[0]
moment_magnitude.mag = '%4.1f' % moment_magnitude.mag moment_magnitude.mag = '%4.1f' % moment_magnitude.mag
if len(event.magnitudes) > 1:
local_magnitude = event.magnitudes[1] local_magnitude = event.magnitudes[1]
local_magnitude.mag = '%4.1f' % local_magnitude.mag 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_momentmag.setText(str(moment_magnitude.mag))
item_localmag.setText(str(local_magnitude.mag)) item_localmag.setText(str(local_magnitude.mag))
item_notes.setText(event.notes) item_notes.setText(event.notes)

View File

@ -950,10 +950,13 @@ def check4rotated(data, metadata=None, verbosity=1):
if any(rotation_required): if any(rotation_required):
t_start = full_range(wfstream) t_start = full_range(wfstream)
try: try:
azimuts = [metadata.get_coordinates(tr_id, t_start)['azimuth'] for tr_id in trace_ids] azimuts = []
dips = [metadata.get_coordinates(tr_id, t_start)['dip'] for tr_id in trace_ids] 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: 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 return wfstream
if len(wfstream) < 3: if len(wfstream) < 3:
print('Failed to rotate Stream {}, not enough components available.'.format(wfstream)) 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) station = self.orig_parent.getTraceID(wfID)
abstime = self.wfstart + x abstime = self.wfstart + x
if self.orig_parent.get_current_event(): 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.vLine.setPos(mousePoint.x())
self.hLine.setPos(mousePoint.y()) self.hLine.setPos(mousePoint.y())
@ -895,7 +895,7 @@ class WaveformWidgetPG(QtWidgets.QWidget):
''' '''
npixel = self.orig_parent.width() npixel = self.orig_parent.width()
ndata = len(trace.data) ndata = len(trace.data)
pts_per_pixel = ndata / npixel pts_per_pixel = ndata // npixel
if pts_per_pixel < 2: if pts_per_pixel < 2:
return trace.data, time_ax return trace.data, time_ax
remaining_samples = ndata % pts_per_pixel remaining_samples = ndata % pts_per_pixel