mirror of https://gitlab.com/pamhyr/pamhyr2
Results: PlotH: Add current ts line.
parent
87e8e17e91
commit
6e94d7a707
|
|
@ -41,9 +41,9 @@ class ICTranslate(MainTranslate):
|
||||||
self._sub_dict["table_headers"] = {
|
self._sub_dict["table_headers"] = {
|
||||||
# "name": _translate("InitialCondition", "Name"),
|
# "name": _translate("InitialCondition", "Name"),
|
||||||
"kp": self._dict["unit_kp"],
|
"kp": self._dict["unit_kp"],
|
||||||
"speed": self._dict["unit_speed"],
|
|
||||||
"discharge": self._dict["unit_discharge"],
|
"discharge": self._dict["unit_discharge"],
|
||||||
"elevation": self._dict["unit_elevation"],
|
"elevation": self._dict["unit_elevation"],
|
||||||
"height": self._dict["unit_height"],
|
"height": self._dict["unit_height"],
|
||||||
|
"speed": self._dict["unit_speed"],
|
||||||
# "comment": _translate("InitialCondition", "Comment"),
|
# "comment": _translate("InitialCondition", "Comment"),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,16 +112,22 @@ class PlotH(PamhyrPlot):
|
||||||
)
|
)
|
||||||
|
|
||||||
def draw_current(self, reach, profile):
|
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, = self.canvas.axes.plot(
|
||||||
self._current_timestamp,
|
[self._current_timestamp, self._current_timestamp],
|
||||||
y[self.ts.index(self._current_timestamp)],
|
[min(min_y), max(max_y)],
|
||||||
# label=self.label_timestamp,
|
# label=self.label_timestamp,
|
||||||
color=self.color_plot_current,
|
color=self.color_plot_river_bottom,
|
||||||
**kargs
|
linestyle="dashed",
|
||||||
|
lw=1.,
|
||||||
)
|
)
|
||||||
|
|
||||||
def draw_max(self, reach):
|
def draw_max(self, reach):
|
||||||
|
|
@ -175,7 +181,8 @@ class PlotH(PamhyrPlot):
|
||||||
|
|
||||||
self._line.set_data(x, y)
|
self._line.set_data(x, y)
|
||||||
|
|
||||||
|
_, min_max = self._current.get_data()
|
||||||
self._current.set_data(
|
self._current.set_data(
|
||||||
self._current_timestamp,
|
self._current_timestamp,
|
||||||
y[self.ts.index(self._current_timestamp)]
|
min_max
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue