diff --git a/src/View/Results/PlotAC.py b/src/View/Results/PlotAC.py index b2324a9b..5c8cf4d9 100644 --- a/src/View/Results/PlotAC.py +++ b/src/View/Results/PlotAC.py @@ -16,6 +16,8 @@ # -*- coding: utf-8 -*- +import numpy as np + from tools import timer from View.Tools.PamhyrPlot import PamhyrPlot from matplotlib import pyplot as plt @@ -103,11 +105,20 @@ class PlotAC(PamhyrPlot): color=self.color_plot_river_bottom, ) + @timer def draw_water_elevation(self, reach, profile): + result = self.results[self._current_res_id] + x = profile.geometry.get_station() z = profile.geometry.z() rk = reach.geometry.get_rk() - water_z = profile.get_ts_key(self._current_timestamp, "Z") + water_z = result.get("table")["Z"][ + result.get_timestamp_id( + self._current_timestamp + ), + profile.global_index + ] + # water_z = profile.get_ts_key(self._current_timestamp, "Z") self.water, = self.canvas.axes.plot( [min(x), max(x)], [water_z, water_z], @@ -123,11 +134,18 @@ class PlotAC(PamhyrPlot): ) self.liste_chemins = self.collection.get_paths() + @timer def draw_water_elevation_max(self, reach, profile): + result = self.results[self._current_res_id] + x = profile.geometry.get_station() z = profile.geometry.z() rk = reach.geometry.get_rk() - water_z = max(profile.get_key("Z")) + + water_z = np.max( + result.get("table")["Z"][:, profile.global_index] + ) + # water_z = max(profile.get_key("Z")) self.water_max, = self.canvas.axes.plot( [min(x), max(x)], [water_z, water_z], @@ -262,7 +280,15 @@ class PlotAC(PamhyrPlot): self.line_rk.set_data(x, z) def update_water(self, reach, profile, x, z): - water_z = profile.get_ts_key(self._current_timestamp, "Z") + result = self.results[self._current_res_id] + water_z = result.get("table")["Z"][ + result.get_timestamp_id( + self._current_timestamp + ), + profile.global_index + ] + # water_z = profile.get_ts_key(self._current_timestamp, "Z") + self.water.set_data( [min(x), max(x)], [water_z, water_z] @@ -277,7 +303,12 @@ class PlotAC(PamhyrPlot): ) def update_water_max(self, reach, profile, x, z): - water_z = max(profile.get_key("Z")) + result = self.results[self._current_res_id] + water_z = np.max( + result.get("table")["Z"][:, profile.global_index] + ) + # water_z = max(profile.get_key("Z")) + self.water_max.set_data( [min(x), max(x)], [water_z, water_z]