From 6e94d7a70787005dc0664ca936be001236cdeea1 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Tue, 14 May 2024 14:21:33 +0200 Subject: [PATCH] Results: PlotH: Add current ts line. --- src/View/InitialConditions/translate.py | 2 +- src/View/Results/PlotH.py | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/View/InitialConditions/translate.py b/src/View/InitialConditions/translate.py index d3cef4c1..46d5f404 100644 --- a/src/View/InitialConditions/translate.py +++ b/src/View/InitialConditions/translate.py @@ -41,9 +41,9 @@ class ICTranslate(MainTranslate): self._sub_dict["table_headers"] = { # "name": _translate("InitialCondition", "Name"), "kp": self._dict["unit_kp"], - "speed": self._dict["unit_speed"], "discharge": self._dict["unit_discharge"], "elevation": self._dict["unit_elevation"], "height": self._dict["unit_height"], + "speed": self._dict["unit_speed"], # "comment": _translate("InitialCondition", "Comment"), } diff --git a/src/View/Results/PlotH.py b/src/View/Results/PlotH.py index 5dacb2a8..2ac499e4 100644 --- a/src/View/Results/PlotH.py +++ b/src/View/Results/PlotH.py @@ -112,16 +112,22 @@ class PlotH(PamhyrPlot): ) def draw_current(self, reach, profile): - y = profile.get_key("Q") + min_y, max_y = reduce( + lambda acc, p: ( + acc[0] + [min(p.get_key("Q"))], + acc[1] + [max(p.get_key("Q"))] + ), + reach.profiles, + ([], []) + ) - kargs = self.plot_default_kargs.copy() - kargs["marker"] = "o" self._current, = self.canvas.axes.plot( - self._current_timestamp, - y[self.ts.index(self._current_timestamp)], + [self._current_timestamp, self._current_timestamp], + [min(min_y), max(max_y)], # label=self.label_timestamp, - color=self.color_plot_current, - **kargs + color=self.color_plot_river_bottom, + linestyle="dashed", + lw=1., ) def draw_max(self, reach): @@ -175,7 +181,8 @@ class PlotH(PamhyrPlot): self._line.set_data(x, y) + _, min_max = self._current.get_data() self._current.set_data( self._current_timestamp, - y[self.ts.index(self._current_timestamp)] + min_max )