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): def get_kp_min(self):
if len(self.get_kp()) > 0: if len(self.get_kp()) > 0:
return min(self.get_kp()) return min(self.get_kp())

View File

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

View File

@ -185,55 +185,55 @@ class PlotKPZ(PamhyrPlot):
self.draw() self.draw()
return return
if ind is not None: # if ind is not None:
before = ind - 1 # before = ind - 1
after = ind + 1 # after = ind + 1
self.before_plot_selected.set_visible(False) # self.before_plot_selected.set_visible(False)
self.plot_selected.set_visible(False) # self.plot_selected.set_visible(False)
self.after_plot_selected.set_visible(False) # self.after_plot_selected.set_visible(False)
if 0 <= before < self.data.number_profiles: # if 0 <= before < self.data.number_profiles:
profile = self.data.profile(before) # profile = self.data.profile(before)
if len(profile) > 0: # if len(profile) > 0:
kp_i = profile.kp # kp_i = profile.kp
z_min_i = profile.z_min() # z_min_i = profile.z_min()
z_max_i = profile.z_max() # z_max_i = profile.z_max()
self.before_plot_selected.set_data( # self.before_plot_selected.set_data(
(kp_i, kp_i), # (kp_i, kp_i),
(z_min_i, z_max_i) # (z_min_i, z_max_i)
) # )
self.before_plot_selected.set_visible(True) # self.before_plot_selected.set_visible(True)
if 0 <= ind < self.data.number_profiles: # if 0 <= ind < self.data.number_profiles:
profile = self.data.profile(ind) # profile = self.data.profile(ind)
if len(profile) > 0: # if len(profile) > 0:
kp_i = profile.kp # kp_i = profile.kp
z_min_i = profile.z_min() # z_min_i = profile.z_min()
z_max_i = profile.z_max() # z_max_i = profile.z_max()
self.plot_selected.set_data( # self.plot_selected.set_data(
(kp_i, kp_i), # (kp_i, kp_i),
(z_min_i, z_max_i) # (z_min_i, z_max_i)
) # )
self.plot_selected.set_visible(True) # self.plot_selected.set_visible(True)
if 0 <= after < self.data.number_profiles: # if 0 <= after < self.data.number_profiles:
profile = self.data.profile(after) # profile = self.data.profile(after)
if len(profile) > 0: # if len(profile) > 0:
kp_i = profile.kp # kp_i = profile.kp
z_min_i = profile.z_min() # z_min_i = profile.z_min()
z_max_i = profile.z_max() # z_max_i = profile.z_max()
self.after_plot_selected.set_data( # self.after_plot_selected.set_data(
(kp_i, kp_i), # (kp_i, kp_i),
(z_min_i, z_max_i) # (z_min_i, z_max_i)
) # )
self.after_plot_selected.set_visible(True) # self.after_plot_selected.set_visible(True)
self.canvas.figure.canvas.draw_idle() # self.canvas.figure.canvas.draw_idle()
else: # else:
kp = self.data.get_kp_complete_profiles() kp = self.data.get_kp_complete_profiles()
z_min = self.data.get_z_min() z_min = self.data.get_z_min()
z_max = self.data.get_z_max() z_max = self.data.get_z_max()

View File

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