Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr

setup.py
Theophile Terraz 2024-01-26 16:23:52 +01:00
commit 87fa63d8f9
4 changed files with 86 additions and 88 deletions

View File

@ -352,7 +352,6 @@ class Reach(SQLSubModel):
)
)
def get_kp_min(self):
if len(self.get_kp()) > 0:
return min(self.get_kp())

View File

@ -340,36 +340,36 @@ class PlotAC(PamhyrPlot):
self.color_complete_gl = self.get_line_gl_colors(line_2d)
self.color_incomplete_gl = 2 * ["#000000"]
if ind is not None:
before = ind - 1
after = ind + 1
# if ind is not None:
# before = ind - 1
# after = ind + 1
self.before_plot_selected.set_data([], [])
self.plot_selected.set_data([], [])
self.after_plot_selected.set_data([], [])
# self.before_plot_selected.set_data([], [])
# self.plot_selected.set_data([], [])
# self.after_plot_selected.set_data([], [])
if 0 <= before < self.data.number_profiles:
self.before_plot_selected.set_data(
self.data.profile(before).get_station(),
self.data.profile(before).z()
)
# if 0 <= before < self.data.number_profiles:
# self.before_plot_selected.set_data(
# self.data.profile(before).get_station(),
# self.data.profile(before).z()
# )
if 0 <= ind < self.data.number_profiles:
self.plot_selected.set_data(
self.data.profile(ind).get_station(),
self.data.profile(ind).z()
)
# if 0 <= ind < self.data.number_profiles:
# self.plot_selected.set_data(
# self.data.profile(ind).get_station(),
# self.data.profile(ind).z()
# )
if 0 <= after < self.data.number_profiles:
self.after_plot_selected.set_data(
self.data.profile(after).get_station(),
self.data.profile(after).z()
)
# if 0 <= after < self.data.number_profiles:
# self.after_plot_selected.set_data(
# self.data.profile(after).get_station(),
# self.data.profile(after).z()
# )
self.update_annotate_full(ind)
else:
self.update_full()
self.update_annotate_full(0)
# self.update_annotate_full(ind)
# else:
self.update_full()
self.update_annotate_full(0)
self.canvas.axes.relim()
self.canvas.axes.autoscale()

View File

@ -185,76 +185,76 @@ class PlotKPZ(PamhyrPlot):
self.draw()
return
if ind is not None:
before = ind - 1
after = ind + 1
# if ind is not None:
# before = ind - 1
# after = ind + 1
self.before_plot_selected.set_visible(False)
self.plot_selected.set_visible(False)
self.after_plot_selected.set_visible(False)
# self.before_plot_selected.set_visible(False)
# self.plot_selected.set_visible(False)
# self.after_plot_selected.set_visible(False)
if 0 <= before < self.data.number_profiles:
profile = self.data.profile(before)
if len(profile) > 0:
kp_i = profile.kp
z_min_i = profile.z_min()
z_max_i = profile.z_max()
# if 0 <= before < self.data.number_profiles:
# profile = self.data.profile(before)
# if len(profile) > 0:
# kp_i = profile.kp
# z_min_i = profile.z_min()
# z_max_i = profile.z_max()
self.before_plot_selected.set_data(
(kp_i, kp_i),
(z_min_i, z_max_i)
)
self.before_plot_selected.set_visible(True)
# self.before_plot_selected.set_data(
# (kp_i, kp_i),
# (z_min_i, z_max_i)
# )
# self.before_plot_selected.set_visible(True)
if 0 <= ind < self.data.number_profiles:
profile = self.data.profile(ind)
if len(profile) > 0:
kp_i = profile.kp
z_min_i = profile.z_min()
z_max_i = profile.z_max()
# if 0 <= ind < self.data.number_profiles:
# profile = self.data.profile(ind)
# if len(profile) > 0:
# kp_i = profile.kp
# z_min_i = profile.z_min()
# z_max_i = profile.z_max()
self.plot_selected.set_data(
(kp_i, kp_i),
(z_min_i, z_max_i)
)
self.plot_selected.set_visible(True)
# self.plot_selected.set_data(
# (kp_i, kp_i),
# (z_min_i, z_max_i)
# )
# self.plot_selected.set_visible(True)
if 0 <= after < self.data.number_profiles:
profile = self.data.profile(after)
if len(profile) > 0:
kp_i = profile.kp
z_min_i = profile.z_min()
z_max_i = profile.z_max()
# if 0 <= after < self.data.number_profiles:
# profile = self.data.profile(after)
# if len(profile) > 0:
# kp_i = profile.kp
# z_min_i = profile.z_min()
# z_max_i = profile.z_max()
self.after_plot_selected.set_data(
(kp_i, kp_i),
(z_min_i, z_max_i)
)
self.after_plot_selected.set_visible(True)
# self.after_plot_selected.set_data(
# (kp_i, kp_i),
# (z_min_i, z_max_i)
# )
# self.after_plot_selected.set_visible(True)
self.canvas.figure.canvas.draw_idle()
else:
kp = self.data.get_kp_complete_profiles()
z_min = self.data.get_z_min()
z_max = self.data.get_z_max()
# self.canvas.figure.canvas.draw_idle()
# else:
kp = self.data.get_kp_complete_profiles()
z_min = self.data.get_z_min()
z_max = self.data.get_z_max()
self.line_kp_zmin.set_data(kp, z_min)
self.line_kp_zmin.set_data(kp, z_min)
self.line_kp_zmin_zmax.remove()
self.line_kp_zmin_zmax = self.canvas.axes.vlines(
x=kp,
ymin=z_min, ymax=z_max,
color='r', lw=1.
)
self.line_kp_zmin_zmax.remove()
self.line_kp_zmin_zmax = self.canvas.axes.vlines(
x=kp,
ymin=z_min, ymax=z_max,
color='r', lw=1.
)
z_complete = self.data.get_guidelines_z()
try:
for i in range(len(self.line_kp_zgl)):
self.line_kp_zgl[i][0].set_data(
kp, z_complete[i]
)
except Exception as e:
logger.warning(f"Failed to update graphic KPZ: {e}")
z_complete = self.data.get_guidelines_z()
try:
for i in range(len(self.line_kp_zgl)):
self.line_kp_zgl[i][0].set_data(
kp, z_complete[i]
)
except Exception as e:
logger.warning(f"Failed to update graphic KPZ: {e}")
self.canvas.axes.autoscale_view(True, True, True)
self.canvas.figure.canvas.draw_idle()
self.canvas.axes.autoscale_view(True, True, True)
self.canvas.figure.canvas.draw_idle()

View File

@ -356,7 +356,6 @@ class GeometryWindow(PamhyrWindow):
def select_plot_ac(self, ind: int):
self.tableView.model().blockSignals(True)
logger.info(f"select_plot_ac(self, {ind})")
self._plot_ac.update(ind=ind)
self.tableView.model().blockSignals(False)