mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
put compare solvers in results window
This commit is contained in:
1 parent
8d9a196059
commit
41d1fb9d59
11 files changed
+224
-99
No files matched your search
@@ -32,7 +32,7 @@ logger = logging.getLogger()
|
||||
|
||||
class PlotRKC(PamhyrPlot):
|
||||
def __init__(self, canvas=None, trad=None, toolbar=None,
|
||||
results=None, reach_id=0, profile_id=0,
|
||||
results=None, reach_id=0, profile_id=0, res_id=0,
|
||||
parent=None):
|
||||
super(PlotRKC, self).__init__(
|
||||
canvas=canvas,
|
||||
@@ -42,10 +42,12 @@ class PlotRKC(PamhyrPlot):
|
||||
parent=parent
|
||||
)
|
||||
|
||||
self._timestamps = results.get("timestamps")
|
||||
self._timestamps = results[res_id].get("timestamps")
|
||||
self._current_timestamp = max(results[res_id].get("timestamps"))
|
||||
self._current_timestamp = max(self._timestamps)
|
||||
self._current_reach_id = reach_id
|
||||
self._current_profile_id = profile_id
|
||||
self._current_res_id = res_id
|
||||
|
||||
self.label_x = self._trad["unit_rk"]
|
||||
self.label_y = self._trad["unit_elevation"]
|
||||
@@ -63,7 +65,7 @@ class PlotRKC(PamhyrPlot):
|
||||
@results.setter
|
||||
def results(self, results):
|
||||
self.data = results
|
||||
self._current_timestamp = max(results.get("timestamps"))
|
||||
self._current_timestamp = max(results[self._current_res_id].get("timestamps"))
|
||||
|
||||
@timer
|
||||
def draw(self, highlight=None):
|
||||
@@ -72,7 +74,11 @@ class PlotRKC(PamhyrPlot):
|
||||
if self.results is None:
|
||||
return
|
||||
|
||||
reach = self.results.river.reach(self._current_reach_id)
|
||||
if self.results[self._current_res_id] is None:
|
||||
return
|
||||
|
||||
results = self.results[self._current_res_id]
|
||||
reach = results.river.reach(self._current_reach_id)
|
||||
|
||||
self.draw_bottom(reach)
|
||||
self.draw_water_elevation(reach)
|
||||
@@ -111,7 +117,7 @@ class PlotRKC(PamhyrPlot):
|
||||
lambda hs: hs._input_reach.reach is reach.geometry,
|
||||
filter(
|
||||
lambda hs: hs._input_reach is not None,
|
||||
self.results.study.river.hydraulic_structures.lst
|
||||
self.results[self._current_res_id].study.river.hydraulic_structures.lst
|
||||
)
|
||||
)
|
||||
|
||||
@@ -312,6 +318,10 @@ class PlotRKC(PamhyrPlot):
|
||||
self._current_profile_id = profile_id
|
||||
self.update_current()
|
||||
|
||||
def set_result(self, res_id):
|
||||
self._current_result_id = res_id
|
||||
self.update()
|
||||
|
||||
def set_timestamp(self, timestamp):
|
||||
self._current_timestamp = timestamp
|
||||
self.update()
|
||||
@@ -320,7 +330,8 @@ class PlotRKC(PamhyrPlot):
|
||||
if not self._init:
|
||||
self.draw()
|
||||
|
||||
reach = self.results.river.reach(self._current_reach_id)
|
||||
results = self.results[self._current_res_id]
|
||||
reach = results.river.reach(self._current_reach_id)
|
||||
if reach.has_sediment():
|
||||
self.update_bottom_with_bedload()
|
||||
|
||||
@@ -329,7 +340,8 @@ class PlotRKC(PamhyrPlot):
|
||||
self.update_idle()
|
||||
|
||||
def update_water_elevation(self):
|
||||
reach = self.results.river.reach(self._current_reach_id)
|
||||
results = self.results[self._current_res_id]
|
||||
reach = results.river.reach(self._current_reach_id)
|
||||
rk = reach.geometry.get_rk()
|
||||
z_min = reach.geometry.get_z_min()
|
||||
|
||||
@@ -354,7 +366,8 @@ class PlotRKC(PamhyrPlot):
|
||||
)
|
||||
|
||||
def update_current(self):
|
||||
reach = self.results.river.reach(self._current_reach_id)
|
||||
results = self.results[self._current_res_id]
|
||||
reach = results.river.reach(self._current_reach_id)
|
||||
rk = reach.geometry.get_rk()
|
||||
z_min = reach.geometry.get_z_min()
|
||||
z_max = reach.geometry.get_z_max()
|
||||
@@ -367,7 +380,8 @@ class PlotRKC(PamhyrPlot):
|
||||
self.canvas.figure.canvas.draw_idle()
|
||||
|
||||
def update_bottom_with_bedload(self):
|
||||
reach = self.results.river.reach(self._current_reach_id)
|
||||
results = self.results[self._current_res_id]
|
||||
reach = results.river.reach(self._current_reach_id)
|
||||
rk = reach.geometry.get_rk()
|
||||
z = self.sl_compute_current_z(reach)
|
||||
|
||||
|
||||
Reference in new issue
Block a user