mirror of https://gitlab.com/pamhyr/pamhyr2
cosmetic
parent
fa8f07b97e
commit
d3729cfe77
|
|
@ -88,20 +88,21 @@ class PlotH(PamhyrPlot):
|
||||||
if len(self._current_res_id) < 1:
|
if len(self._current_res_id) < 1:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if len(self._current_res_id) == 1:
|
||||||
|
self.draw_max(self._current_res_id[0])
|
||||||
|
|
||||||
for res_id in self._current_res_id:
|
for res_id in self._current_res_id:
|
||||||
if self.results[res_id] is None:
|
if self.results[res_id] is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
results = self.results[res_id]
|
results = self.results[res_id]
|
||||||
reach = results.river.reach(self._current_reach_id)
|
reach = results.river.reach(self._current_reach_id)
|
||||||
profile = reach.profile(self._current_profile_id)
|
|
||||||
|
|
||||||
if reach.geometry.number_profiles == 0:
|
if reach.geometry.number_profiles == 0:
|
||||||
self._init = False
|
self._init = False
|
||||||
return
|
return
|
||||||
|
|
||||||
self.draw_max(reach)
|
self.draw_data(res_id)
|
||||||
self.draw_data(reach, profile)
|
|
||||||
|
|
||||||
self.canvas.axes.set_xlabel(
|
self.canvas.axes.set_xlabel(
|
||||||
self._trad["unit_time_s"],
|
self._trad["unit_time_s"],
|
||||||
|
|
@ -122,15 +123,28 @@ class PlotH(PamhyrPlot):
|
||||||
self.draw_current()
|
self.draw_current()
|
||||||
self._init = True
|
self._init = True
|
||||||
|
|
||||||
def draw_data(self, reach, profile):
|
def draw_data(self, res_id):
|
||||||
|
|
||||||
|
results = self.results[res_id]
|
||||||
|
reach = results.river.reach(self._current_reach_id)
|
||||||
|
profile = reach.profile(self._current_profile_id)
|
||||||
|
|
||||||
x = self._timestamps
|
x = self._timestamps
|
||||||
y = profile.get_key("Q")
|
y = profile.get_key("Q")
|
||||||
|
|
||||||
|
if res_id == 2:
|
||||||
|
label = "Δ " + self.label_discharge
|
||||||
|
else:
|
||||||
|
label = self.label_discharge
|
||||||
|
|
||||||
|
if len(self._current_res_id) > 1:
|
||||||
|
if res_id != 2:
|
||||||
|
label += f" ({results._solver.name})"
|
||||||
|
|
||||||
line, = self.canvas.axes.plot(
|
line, = self.canvas.axes.plot(
|
||||||
x, y,
|
x, y,
|
||||||
label=self.label_discharge,
|
label=label,
|
||||||
color=self.color_plot,
|
color=self.colors[res_id + 1],
|
||||||
**self.plot_default_kargs
|
**self.plot_default_kargs
|
||||||
)
|
)
|
||||||
self._line.append(line)
|
self._line.append(line)
|
||||||
|
|
@ -145,10 +159,23 @@ class PlotH(PamhyrPlot):
|
||||||
lw=1.,
|
lw=1.,
|
||||||
)
|
)
|
||||||
|
|
||||||
def draw_max(self, reach):
|
def draw_max(self, res_id):
|
||||||
|
results = self.results[res_id]
|
||||||
|
reach = results.river.reach(self._current_reach_id)
|
||||||
|
profile = reach.profile(self._current_profile_id)
|
||||||
|
|
||||||
|
if reach.geometry.number_profiles == 0:
|
||||||
|
self._init = False
|
||||||
|
return
|
||||||
|
|
||||||
x = self._timestamps
|
x = self._timestamps
|
||||||
y = []
|
y = []
|
||||||
|
|
||||||
|
if res_id == 2:
|
||||||
|
label = "Δ " + self.label_discharge_max
|
||||||
|
else:
|
||||||
|
label = self.label_discharge_max
|
||||||
|
|
||||||
for ts in x:
|
for ts in x:
|
||||||
ts_y = -9999
|
ts_y = -9999
|
||||||
for profile in reach.profiles:
|
for profile in reach.profiles:
|
||||||
|
|
@ -158,7 +185,7 @@ class PlotH(PamhyrPlot):
|
||||||
|
|
||||||
m, = self.canvas.axes.plot(
|
m, = self.canvas.axes.plot(
|
||||||
x, y,
|
x, y,
|
||||||
label=self.label_discharge_max,
|
label=label,
|
||||||
color=self.color_plot_highlight,
|
color=self.color_plot_highlight,
|
||||||
linestyle='dotted',
|
linestyle='dotted',
|
||||||
**self.plot_default_kargs
|
**self.plot_default_kargs
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue