more custom plots

adists_release
Theophile Terraz 2024-08-07 11:33:41 +02:00
parent d19506f1ad
commit fb62298bd2
3 changed files with 78 additions and 21 deletions

View File

@ -33,6 +33,8 @@ unit = {
"water_elevation": "0-meter",
"discharge": "1-m3s",
"velocity": "2-ms",
"depth": "3-meter",
"mean_depth": "3-meter",
}
@ -152,6 +154,39 @@ class CustomPlot(PamhyrPlot):
)
lines["velocity"] = line
if "depth" in self._y:
ax = self._axes[unit["depth"]]
d = list(
map(
lambda p: p.geometry.max_water_depth(
p.get_ts_key(self._timestamp, "Z")),
reach.profiles
)
)
line = ax.plot(
rk, d,
color='brown', lw=1.,
)
lines["depth"] = line
if "mean_depth" in self._y:
ax = self._axes[unit["depth"]]
d = list(
map(
lambda p: p.geometry.mean_water_depth(
p.get_ts_key(self._timestamp, "Z")),
reach.profiles
)
)
line = ax.plot(
rk, d,
color='orange', lw=1.,
)
lines["depth"] = line
# Legend
lns = reduce(
lambda acc, line: acc + line,
@ -221,19 +256,19 @@ class CustomPlot(PamhyrPlot):
q = profile.get_key("Q")
z = profile.get_key("Z")
z_min = profile.geometry.z_min()
ts_z_min = list(
map(
lambda ts: z_min,
ts
)
)
lines = {}
if "elevation" in self._y:
# Z min is constant in time
ax = self._axes[unit["elevation"]]
z_min = profile.geometry.z_min()
ts_z_min = list(
map(
lambda ts: z_min,
ts
)
)
line = ax.plot(
ts, ts_z_min,
@ -251,13 +286,6 @@ class CustomPlot(PamhyrPlot):
lines["water_elevation"] = line
if "elevation" in self._y:
z_min = profile.geometry.z_min()
ts_z_min = list(
map(
lambda ts: z_min,
ts
)
)
ax.fill_between(
ts, ts_z_min, z,
@ -289,6 +317,32 @@ class CustomPlot(PamhyrPlot):
)
lines["velocity"] = line
if "depth" in self._y:
ax = self._axes[unit["depth"]]
d = list(
map(lambda z: profile.geometry.max_water_depth(z), z)
)
line = ax.plot(
ts, d,
color='brown', lw=1.,
)
lines["depth"] = line
if "mean_depth" in self._y:
ax = self._axes[unit["depth"]]
d = list(
map(lambda z: profile.geometry.mean_water_depth(z), z)
)
line = ax.plot(
ts, d,
color='orange', lw=1.,
)
lines["depth"] = line
self._customize_x_axes_time(ts)
# Legend

View File

@ -41,12 +41,12 @@ class CustomPlotTranslate(ResultsTranslate):
"CustomPlot", "Bed elevation (m)"
)
self._dict['velocity'] = self._dict["unit_speed"]
self._dict['width'] = self._dict["unit_width"],
self._dict['max_depth'] = self._dict["unit_max_height"],
self._dict['mean_depth'] = self._dict["unit_mean_height"],
self._dict['wet_area'] = self._dict["unit_wet_area"],
self._dict['wet_perimeter'] = self._dict["unit_wet_perimeter"],
self._dict['hydraulic_radius'] = self._dict["unit_hydraulic_radius"],
self._dict['width'] = self._dict["unit_width"]
self._dict['max_depth'] = self._dict["unit_max_height"]
self._dict['mean_depth'] = self._dict["unit_mean_height"]
self._dict['wet_area'] = self._dict["unit_wet_area"]
self._dict['wet_perimeter'] = self._dict["unit_wet_perimeter"]
self._dict['hydraulic_radius'] = self._dict["unit_hydraulic_radius"]
# Unit corresponding long name (plot axes display)
@ -55,6 +55,7 @@ class CustomPlotTranslate(ResultsTranslate):
)
self._dict['1-m3s'] = self._dict["unit_discharge"]
self._dict['2-ms'] = self._dict["unit_speed"]
self._dict['3-meter'] = self._dict["unit_height"]
# SubDict
@ -67,4 +68,6 @@ class CustomPlotTranslate(ResultsTranslate):
"water_elevation": self._dict["water_elevation"],
"discharge": self._dict["discharge"],
"velocity": self._dict["velocity"],
"depth": self._dict["max_depth"],
"mean_depth": self._dict["mean_depth"],
}

View File

@ -3057,7 +3057,7 @@
</message>
<message>
<location filename="../View/Translate.py" line="57"/>
<source>Height (m)</source>
<source>Depth (m)</source>
<translation>Hauteur (m)</translation>
</message>
<message>