[update] some general bugfixes and improvements in array map
This commit is contained in:
parent
5d6f4619cc
commit
2e49813292
3
PyLoT.py
3
PyLoT.py
@ -686,10 +686,9 @@ class MainWindow(QMainWindow):
|
|||||||
# add scroll area used in case number of traces gets too high
|
# add scroll area used in case number of traces gets too high
|
||||||
self.wf_scroll_area = QtWidgets.QScrollArea(self)
|
self.wf_scroll_area = QtWidgets.QScrollArea(self)
|
||||||
self.wf_scroll_area.setVisible(False)
|
self.wf_scroll_area.setVisible(False)
|
||||||
self.no_data_label = QLabel('No Data')
|
self.no_data_label = QLabel('No Data. If data were already loaded, try to select the event again in the eventbox.')
|
||||||
self.no_data_label.setStyleSheet('color: red')
|
self.no_data_label.setStyleSheet('color: red')
|
||||||
self.no_data_label.setAlignment(Qt.AlignCenter)
|
self.no_data_label.setAlignment(Qt.AlignCenter)
|
||||||
|
|
||||||
# create central matplotlib figure canvas widget
|
# create central matplotlib figure canvas widget
|
||||||
self.init_wfWidget()
|
self.init_wfWidget()
|
||||||
|
|
||||||
|
@ -5,12 +5,13 @@ import traceback
|
|||||||
|
|
||||||
import cartopy.crs as ccrs
|
import cartopy.crs as ccrs
|
||||||
import cartopy.feature as cf
|
import cartopy.feature as cf
|
||||||
|
from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
|
||||||
import matplotlib
|
import matplotlib
|
||||||
import matplotlib.patheffects as PathEffects
|
import matplotlib.patheffects as PathEffects
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import obspy
|
import obspy
|
||||||
from PySide2 import QtWidgets
|
from PySide2 import QtWidgets, QtGui
|
||||||
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
|
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
|
||||||
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
||||||
from pylot.core.util.utils import identifyPhaseID
|
from pylot.core.util.utils import identifyPhaseID
|
||||||
@ -24,10 +25,10 @@ matplotlib.use('Qt5Agg')
|
|||||||
|
|
||||||
class MplCanvas(FigureCanvas):
|
class MplCanvas(FigureCanvas):
|
||||||
|
|
||||||
def __init__(self, parent=None, extern_axes=None, width=5, height=4, dpi=100):
|
def __init__(self, extern_axes=None, projection=None, width=15, height=5, dpi=100):
|
||||||
if extern_axes is None:
|
if extern_axes is None:
|
||||||
self.fig = plt.figure(figsize=(width, height), dpi=dpi)
|
self.fig = plt.figure(figsize=(width, height), dpi=dpi)
|
||||||
self.axes = self.fig.add_subplot(111)
|
self.axes = self.fig.add_subplot(111, projection=projection)
|
||||||
else:
|
else:
|
||||||
self.fig = extern_axes.figure
|
self.fig = extern_axes.figure
|
||||||
self.axes = extern_axes
|
self.axes = extern_axes
|
||||||
@ -63,20 +64,25 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
self.highlighted_stations = []
|
self.highlighted_stations = []
|
||||||
|
|
||||||
# call functions to draw everything
|
# call functions to draw everything
|
||||||
|
self.projection = ccrs.PlateCarree()
|
||||||
self.init_graphics()
|
self.init_graphics()
|
||||||
|
self.ax = self.canvas.axes
|
||||||
|
self.ax.set_adjustable('datalim')
|
||||||
|
|
||||||
self.init_stations()
|
self.init_stations()
|
||||||
self.init_crtpyMap()
|
self.init_crtpyMap()
|
||||||
self.init_map()
|
self.init_map()
|
||||||
|
|
||||||
# set original map limits to fall back on when home button is pressed
|
# set original map limits to fall back on when home button is pressed
|
||||||
self.org_xlim = self.canvas.axes.get_xlim()
|
self.org_xlim = self.ax.get_xlim()
|
||||||
self.org_ylim = self.canvas.axes.get_ylim()
|
self.org_ylim = self.ax.get_ylim()
|
||||||
|
|
||||||
# initial map without event
|
# initial map without event
|
||||||
self.canvas.axes.set_xlim(self.org_xlim[0], self.org_xlim[1])
|
self.ax.set_xlim(self.org_xlim[0], self.org_xlim[1])
|
||||||
self.canvas.axes.set_ylim(self.org_ylim[0], self.org_ylim[1])
|
self.ax.set_ylim(self.org_ylim[0], self.org_ylim[1])
|
||||||
|
|
||||||
self._style = None if not hasattr(parent, '_style') else parent._style
|
self._style = None if not hasattr(parent, '_style') else parent._style
|
||||||
|
|
||||||
|
|
||||||
def init_map(self):
|
def init_map(self):
|
||||||
self.init_colormap()
|
self.init_colormap()
|
||||||
self.connectSignals()
|
self.connectSignals()
|
||||||
@ -89,11 +95,11 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
# initialize figure elements
|
# initialize figure elements
|
||||||
|
|
||||||
if self.extern_plot_axes is None:
|
if self.extern_plot_axes is None:
|
||||||
self.canvas = MplCanvas(self)
|
self.canvas = MplCanvas(projection=self.projection)
|
||||||
self.plotWidget = FigureCanvas(self.canvas.fig)
|
|
||||||
else:
|
else:
|
||||||
self.canvas = MplCanvas(self, extern_axes=self.extern_plot_axes)
|
self.canvas = MplCanvas(extern_axes=self.extern_plot_axes)
|
||||||
self.plotWidget = FigureCanvas(self.canvas.fig)
|
|
||||||
|
self.plotWidget = self.canvas
|
||||||
|
|
||||||
# initialize GUI elements
|
# initialize GUI elements
|
||||||
self.status_label = QtWidgets.QLabel()
|
self.status_label = QtWidgets.QLabel()
|
||||||
@ -105,7 +111,7 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
self.setLayout(self.main_box)
|
self.setLayout(self.main_box)
|
||||||
|
|
||||||
self.top_row = QtWidgets.QHBoxLayout()
|
self.top_row = QtWidgets.QHBoxLayout()
|
||||||
self.main_box.addLayout(self.top_row, 1)
|
self.main_box.addLayout(self.top_row, 0)
|
||||||
|
|
||||||
self.comboBox_phase = QtWidgets.QComboBox()
|
self.comboBox_phase = QtWidgets.QComboBox()
|
||||||
self.comboBox_phase.insertItem(0, 'P')
|
self.comboBox_phase.insertItem(0, 'P')
|
||||||
@ -138,10 +144,10 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
self.top_row.addWidget(self.auto_refresh_box)
|
self.top_row.addWidget(self.auto_refresh_box)
|
||||||
self.top_row.addWidget(self.refresh_button)
|
self.top_row.addWidget(self.refresh_button)
|
||||||
|
|
||||||
self.main_box.addWidget(self.plotWidget, 1)
|
self.main_box.addWidget(self.plotWidget, 10)
|
||||||
|
|
||||||
self.bot_row = QtWidgets.QHBoxLayout()
|
self.bot_row = QtWidgets.QHBoxLayout()
|
||||||
self.main_box.addLayout(self.bot_row, 0.3)
|
self.main_box.addLayout(self.bot_row, 0)
|
||||||
self.bot_row.addWidget(QtWidgets.QLabel(''), 5)
|
self.bot_row.addWidget(QtWidgets.QLabel(''), 5)
|
||||||
self.bot_row.addWidget(self.map_reset_button, 2)
|
self.bot_row.addWidget(self.map_reset_button, 2)
|
||||||
self.bot_row.addWidget(self.go2eq_button, 2)
|
self.bot_row.addWidget(self.go2eq_button, 2)
|
||||||
@ -153,14 +159,12 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
self.init_lat_lon_grid()
|
self.init_lat_lon_grid()
|
||||||
|
|
||||||
def init_crtpyMap(self):
|
def init_crtpyMap(self):
|
||||||
self.canvas.axes.cla()
|
self.ax.add_feature(cf.LAND)
|
||||||
self.canvas.axes = plt.axes(projection=ccrs.PlateCarree())
|
self.ax.add_feature(cf.OCEAN)
|
||||||
self.canvas.axes.add_feature(cf.LAND)
|
self.ax.add_feature(cf.COASTLINE, linewidth=1, edgecolor='gray')
|
||||||
self.canvas.axes.add_feature(cf.OCEAN)
|
self.ax.add_feature(cf.BORDERS, alpha=0.7)
|
||||||
self.canvas.axes.add_feature(cf.COASTLINE, linewidth=1, edgecolor='gray')
|
self.ax.add_feature(cf.LAKES, alpha=0.7)
|
||||||
self.canvas.axes.add_feature(cf.BORDERS, alpha=0.7)
|
self.ax.add_feature(cf.RIVERS, linewidth=1)
|
||||||
self.canvas.axes.add_feature(cf.LAKES, alpha=0.7)
|
|
||||||
self.canvas.axes.add_feature(cf.RIVERS, linewidth=1)
|
|
||||||
|
|
||||||
# parallels and meridians
|
# parallels and meridians
|
||||||
self.add_merid_paral()
|
self.add_merid_paral()
|
||||||
@ -168,12 +172,8 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
self.canvas.fig.tight_layout()
|
self.canvas.fig.tight_layout()
|
||||||
|
|
||||||
def add_merid_paral(self):
|
def add_merid_paral(self):
|
||||||
self.gridlines = self.canvas.axes.gridlines(draw_labels=False, alpha=0.6, color='gray',
|
self.gridlines = self.ax.gridlines(draw_labels=False, alpha=0.6, color='gray',
|
||||||
linewidth=self.linewidth / 2, zorder=7)
|
linewidth=self.linewidth / 2, zorder=7, crs=ccrs.PlateCarree())
|
||||||
# TODO: current cartopy version does not support label removal. Devs are working on it.
|
|
||||||
# Should be fixed in coming cartopy versions
|
|
||||||
# self.gridlines.xformatter = LONGITUDE_FORMATTER
|
|
||||||
# self.gridlines.yformatter = LATITUDE_FORMATTER
|
|
||||||
|
|
||||||
def remove_merid_paral(self):
|
def remove_merid_paral(self):
|
||||||
if len(self.gridlines.xline_artists):
|
if len(self.gridlines.xline_artists):
|
||||||
@ -181,24 +181,24 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
self.gridlines.yline_artists[0].remove()
|
self.gridlines.yline_artists[0].remove()
|
||||||
|
|
||||||
def org_map_view(self):
|
def org_map_view(self):
|
||||||
self.canvas.axes.set_xlim(self.org_xlim[0], self.org_xlim[1])
|
self.ax.set_xlim(self.org_xlim[0], self.org_xlim[1])
|
||||||
self.canvas.axes.set_ylim(self.org_ylim[0], self.org_ylim[1])
|
self.ax.set_ylim(self.org_ylim[0], self.org_ylim[1])
|
||||||
# parallels and meridians
|
# parallels and meridians
|
||||||
self.remove_merid_paral()
|
#self.remove_merid_paral()
|
||||||
self.add_merid_paral()
|
#self.add_merid_paral()
|
||||||
|
|
||||||
self.canvas.axes.figure.canvas.draw_idle()
|
self.canvas.draw_idle()
|
||||||
|
|
||||||
def go2eq(self):
|
def go2eq(self):
|
||||||
if self.eventLoc:
|
if self.eventLoc:
|
||||||
lats, lons = self.eventLoc
|
lats, lons = self.eventLoc
|
||||||
self.canvas.axes.set_xlim(lons - 10, lons + 10)
|
self.ax.set_xlim(lons - 10, lons + 10)
|
||||||
self.canvas.axes.set_ylim(lats - 5, lats + 5)
|
self.ax.set_ylim(lats - 5, lats + 5)
|
||||||
# parallels and meridians
|
# parallels and meridians
|
||||||
self.remove_merid_paral()
|
#self.remove_merid_paral()
|
||||||
self.add_merid_paral()
|
#self.add_merid_paral()
|
||||||
|
|
||||||
self.canvas.axes.figure.canvas.draw_idle()
|
self.canvas.draw_idle()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.status_label.setText('No event information available')
|
self.status_label.setText('No event information available')
|
||||||
@ -220,21 +220,30 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
|
|
||||||
# set mouse events -----------------------------------------------------
|
# set mouse events -----------------------------------------------------
|
||||||
def mouse_moved(self, event):
|
def mouse_moved(self, event):
|
||||||
if not event.inaxes == self.canvas.axes:
|
if not event.inaxes == self.ax:
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
cont, inds = self.sc.contains(event)
|
||||||
lat = event.ydata
|
lat = event.ydata
|
||||||
lon = event.xdata
|
lon = event.xdata
|
||||||
self.status_label.setText('Latitude: {:3.5f}, Longitude: {:3.5f}'.format(lat, lon))
|
text = f'Longitude: {lon:3.3f}, Latitude: {lat:3.3f}'
|
||||||
|
|
||||||
|
if cont:
|
||||||
|
indices = inds['ind']
|
||||||
|
text += ' | Station: ' if len(indices) == 1 else ' | Stations: '
|
||||||
|
text += ' - '.join([self._station_onpick_ids[index] for index in indices])
|
||||||
|
|
||||||
|
self.status_label.setText(text)
|
||||||
|
|
||||||
def mouse_scroll(self, event):
|
def mouse_scroll(self, event):
|
||||||
if not event.inaxes == self.canvas.axes:
|
if not event.inaxes == self.ax:
|
||||||
return
|
return
|
||||||
|
|
||||||
zoom = {'up': 1. / 2., 'down': 2.}
|
zoom = {'up': 1. / 2., 'down': 2.}
|
||||||
|
|
||||||
if event.button in zoom:
|
if event.button in zoom:
|
||||||
xlim = self.canvas.axes.get_xlim()
|
xlim = self.ax.get_xlim()
|
||||||
ylim = self.canvas.axes.get_ylim()
|
ylim = self.ax.get_ylim()
|
||||||
|
|
||||||
x, y = event.xdata, event.ydata
|
x, y = event.xdata, event.ydata
|
||||||
|
|
||||||
@ -246,24 +255,24 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
yb = y - 0.5 * ydiff
|
yb = y - 0.5 * ydiff
|
||||||
yt = y + 0.5 * ydiff
|
yt = y + 0.5 * ydiff
|
||||||
|
|
||||||
self.canvas.axes.set_xlim(xl, xr)
|
self.ax.set_xlim(xl, xr)
|
||||||
self.canvas.axes.set_ylim(yb, yt)
|
self.ax.set_ylim(yb, yt)
|
||||||
# parallels and meridians
|
# parallels and meridians
|
||||||
self.remove_merid_paral()
|
#self.remove_merid_paral()
|
||||||
self.add_merid_paral()
|
#self.add_merid_paral()
|
||||||
|
|
||||||
self.canvas.axes.figure.canvas.draw_idle()
|
self.ax.figure.canvas.draw_idle()
|
||||||
|
|
||||||
def mouseLeftPress(self, event):
|
def mouseLeftPress(self, event):
|
||||||
if not event.inaxes == self.canvas.axes:
|
if not event.inaxes == self.ax:
|
||||||
return
|
return
|
||||||
self.map_x = event.xdata
|
self.map_x = event.xdata
|
||||||
self.map_y = event.ydata
|
self.map_y = event.ydata
|
||||||
self.map_xlim = self.canvas.axes.get_xlim()
|
self.map_xlim = self.ax.get_xlim()
|
||||||
self.map_ylim = self.canvas.axes.get_ylim()
|
self.map_ylim = self.ax.get_ylim()
|
||||||
|
|
||||||
def mouseLeftRelease(self, event):
|
def mouseLeftRelease(self, event):
|
||||||
if not event.inaxes == self.canvas.axes:
|
if not event.inaxes == self.ax:
|
||||||
return
|
return
|
||||||
new_x = event.xdata
|
new_x = event.xdata
|
||||||
new_y = event.ydata
|
new_y = event.ydata
|
||||||
@ -271,13 +280,13 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
dx = new_x - self.map_x
|
dx = new_x - self.map_x
|
||||||
dy = new_y - self.map_y
|
dy = new_y - self.map_y
|
||||||
|
|
||||||
self.canvas.axes.set_xlim((self.map_xlim[0] - dx, self.map_xlim[1] - dx))
|
self.ax.set_xlim((self.map_xlim[0] - dx, self.map_xlim[1] - dx))
|
||||||
self.canvas.axes.set_ylim(self.map_ylim[0] - dy, self.map_ylim[1] - dy)
|
self.ax.set_ylim(self.map_ylim[0] - dy, self.map_ylim[1] - dy)
|
||||||
# parallels and meridians
|
# parallels and meridians
|
||||||
self.remove_merid_paral()
|
#self.remove_merid_paral()
|
||||||
self.add_merid_paral()
|
#self.add_merid_paral()
|
||||||
|
|
||||||
self.canvas.axes.figure.canvas.draw_idle()
|
self.ax.figure.canvas.draw_idle()
|
||||||
|
|
||||||
def onpick(self, event):
|
def onpick(self, event):
|
||||||
btn_msg = {1: ' in selection. Aborted', 2: ' to delete a pick on. Aborted', 3: ' to display info.'}
|
btn_msg = {1: ' in selection. Aborted', 2: ' to delete a pick on. Aborted', 3: ' to display info.'}
|
||||||
@ -469,12 +478,19 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
stat_dict = self.stations_dict['{}.{}'.format(network, station)]
|
stat_dict = self.stations_dict['{}.{}'.format(network, station)]
|
||||||
lat = stat_dict['latitude']
|
lat = stat_dict['latitude']
|
||||||
lon = stat_dict['longitude']
|
lon = stat_dict['longitude']
|
||||||
self.highlighted_stations.append(self.canvas.axes.scatter(lon, lat, s=self.pointsize, edgecolors=color,
|
self.highlighted_stations.append(self.ax.scatter(lon, lat, s=self.pointsize, edgecolors=color,
|
||||||
facecolors='none', zorder=12,
|
facecolors='none', zorder=12,
|
||||||
transform=ccrs.PlateCarree(), label='deleted'))
|
transform=ccrs.PlateCarree(), label='deleted'))
|
||||||
|
|
||||||
def openPickDlg(self, ind):
|
def openPickDlg(self, ind):
|
||||||
wfdata = self._parent.get_data().getWFData()
|
try:
|
||||||
|
wfdata = self._parent.get_data().getWFData()
|
||||||
|
except AttributeError:
|
||||||
|
QtWidgets.QMessageBox.warning(
|
||||||
|
self, "PyLoT Warning",
|
||||||
|
"No waveform data found. Check if they were already loaded in Waveform plot tab."
|
||||||
|
)
|
||||||
|
return
|
||||||
wfdata_comp = self._parent.get_data().getAltWFdata()
|
wfdata_comp = self._parent.get_data().getAltWFdata()
|
||||||
for index in ind:
|
for index in ind:
|
||||||
network, station = self._station_onpick_ids[index].split('.')[:2]
|
network, station = self._station_onpick_ids[index].split('.')[:2]
|
||||||
@ -521,9 +537,9 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
def draw_contour_filled(self, nlevel=50):
|
def draw_contour_filled(self, nlevel=50):
|
||||||
levels = np.linspace(self.get_min_from_picks(), self.get_max_from_picks(), nlevel)
|
levels = np.linspace(self.get_min_from_picks(), self.get_max_from_picks(), nlevel)
|
||||||
|
|
||||||
self.contourf = self.canvas.axes.contourf(self.longrid, self.latgrid, self.picksgrid_active, levels,
|
self.contourf = self.ax.contourf(self.longrid, self.latgrid, self.picksgrid_active, levels,
|
||||||
linewidths=self.linewidth * 5, transform=ccrs.PlateCarree(),
|
linewidths=self.linewidth * 5, transform=ccrs.PlateCarree(),
|
||||||
alpha=0.4, zorder=8, cmap=self.get_colormap())
|
alpha=0.4, zorder=8, cmap=self.get_colormap())
|
||||||
|
|
||||||
def get_colormap(self):
|
def get_colormap(self):
|
||||||
return plt.get_cmap(self.cmaps_box.currentText())
|
return plt.get_cmap(self.cmaps_box.currentText())
|
||||||
@ -531,18 +547,18 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
def scatter_all_stations(self):
|
def scatter_all_stations(self):
|
||||||
stations, lats, lons = self.get_st_lat_lon_for_plot()
|
stations, lats, lons = self.get_st_lat_lon_for_plot()
|
||||||
|
|
||||||
self.sc = self.canvas.axes.scatter(lons, lats, s=self.pointsize * 3, facecolor='none', marker='.',
|
self.sc = self.ax.scatter(lons, lats, s=self.pointsize * 3, facecolor='none', marker='.',
|
||||||
zorder=10, picker=True, edgecolor='0.5', label='Not Picked',
|
zorder=10, picker=True, edgecolor='0.5', label='Not Picked',
|
||||||
transform=ccrs.PlateCarree())
|
transform=ccrs.PlateCarree())
|
||||||
|
|
||||||
self.cid = self.plotWidget.mpl_connect('pick_event', self.onpick)
|
self.cid = self.plotWidget.mpl_connect('pick_event', self.onpick)
|
||||||
self._station_onpick_ids = stations
|
self._station_onpick_ids = stations
|
||||||
if self.eventLoc:
|
if self.eventLoc:
|
||||||
lats, lons = self.eventLoc
|
lats, lons = self.eventLoc
|
||||||
self.sc_event = self.canvas.axes.scatter(lons, lats, s=5 * self.pointsize, facecolor='red', zorder=11,
|
self.sc_event = self.ax.scatter(lons, lats, s=5 * self.pointsize, facecolor='red', zorder=11,
|
||||||
label='Event (might be outside map region)', marker='*',
|
label='Event (might be outside map region)', marker='*',
|
||||||
edgecolors='black',
|
edgecolors='black',
|
||||||
transform=ccrs.PlateCarree())
|
transform=ccrs.PlateCarree())
|
||||||
|
|
||||||
def scatter_picked_stations(self):
|
def scatter_picked_stations(self):
|
||||||
picks, uncertainties, lats, lons = self.get_picks_lat_lon()
|
picks, uncertainties, lats, lons = self.get_picks_lat_lon()
|
||||||
@ -555,8 +571,8 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
for uncertainty in uncertainties])
|
for uncertainty in uncertainties])
|
||||||
|
|
||||||
cmap = self.get_colormap()
|
cmap = self.get_colormap()
|
||||||
self.sc_picked = self.canvas.axes.scatter(lons, lats, s=sizes, edgecolors='white', cmap=cmap,
|
self.sc_picked = self.ax.scatter(lons, lats, s=sizes, edgecolors='white', cmap=cmap,
|
||||||
c=picks, zorder=11, label='Picked', transform=ccrs.PlateCarree())
|
c=picks, zorder=11, label='Picked', transform=ccrs.PlateCarree())
|
||||||
|
|
||||||
def annotate_ax(self):
|
def annotate_ax(self):
|
||||||
self.annotations = []
|
self.annotations = []
|
||||||
@ -574,20 +590,20 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
if st in self.marked_stations:
|
if st in self.marked_stations:
|
||||||
color = 'red'
|
color = 'red'
|
||||||
self.annotations.append(
|
self.annotations.append(
|
||||||
self.canvas.axes.annotate(' %s' % st, xy=(x + 0.003, y + 0.003), fontsize=self.pointsize / 4.,
|
self.ax.annotate(f'{st}', xy=(x + 0.003, y + 0.003), fontsize=self.pointsize / 4.,
|
||||||
fontweight='semibold', color=color, alpha=0.8,
|
fontweight='semibold', color=color, alpha=0.8,
|
||||||
transform=ccrs.PlateCarree(), zorder=14,
|
transform=ccrs.PlateCarree(), zorder=14,
|
||||||
path_effects=[PathEffects.withStroke(
|
path_effects=[PathEffects.withStroke(
|
||||||
linewidth=self.pointsize / 15., foreground='k')]))
|
linewidth=self.pointsize / 15., foreground='k')]))
|
||||||
|
|
||||||
self.legend = self.canvas.axes.legend(loc=1, framealpha=1)
|
self.legend = self.ax.legend(loc=1, framealpha=1)
|
||||||
self.legend.set_zorder(100)
|
self.legend.set_zorder(100)
|
||||||
self.legend.get_frame().set_facecolor((1, 1, 1, 0.95))
|
self.legend.get_frame().set_facecolor((1, 1, 1, 0.95))
|
||||||
|
|
||||||
def add_cbar(self, label):
|
def add_cbar(self, label):
|
||||||
self.cbax_bg = inset_axes(self.canvas.axes, width="6%", height="75%", loc=5)
|
self.cbax_bg = inset_axes(self.ax, width="6%", height="75%", loc=5)
|
||||||
cbax = inset_axes(self.canvas.axes, width='2%', height='70%', loc=5)
|
cbax = inset_axes(self.ax, width='2%', height='70%', loc=5)
|
||||||
cbar = self.canvas.axes.figure.colorbar(self.sc_picked, cax=cbax)
|
cbar = self.ax.figure.colorbar(self.sc_picked, cax=cbax)
|
||||||
cbar.set_label(label)
|
cbar.set_label(label)
|
||||||
cbax.yaxis.tick_left()
|
cbax.yaxis.tick_left()
|
||||||
cbax.yaxis.set_label_position('left')
|
cbax.yaxis.set_label_position('left')
|
||||||
|
@ -1084,8 +1084,9 @@ def check4rotated(data, metadata=None, verbosity=1):
|
|||||||
azimuths.append(metadata.get_coordinates(tr_id, t_start)['azimuth'])
|
azimuths.append(metadata.get_coordinates(tr_id, t_start)['azimuth'])
|
||||||
dips.append(metadata.get_coordinates(tr_id, t_start)['dip'])
|
dips.append(metadata.get_coordinates(tr_id, t_start)['dip'])
|
||||||
except (KeyError, TypeError) as err:
|
except (KeyError, TypeError) as err:
|
||||||
logging.error(f"{type(err)=} occurred: {err=} Rotating not possible, not all azimuth and dip information "
|
logging.warning(f"Rotating not possible, not all azimuth and dip information "
|
||||||
f"available in metadata. Stream remains unchanged.")
|
f"available in metadata. Stream remains unchanged.")
|
||||||
|
logging.debug(f"Rotating not possible, {err=}, {type(err)=}")
|
||||||
return wfs_in
|
return wfs_in
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print(f"Unexpected {err=}, {type(err)=}")
|
print(f"Unexpected {err=}, {type(err)=}")
|
||||||
|
Loading…
Reference in New Issue
Block a user