mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
5 Commits
662a218e41
...
3e094af325
| Author | SHA1 | Date |
|---|---|---|
|
|
3e094af325 | |
|
|
762e4d70a0 | |
|
|
6c4f863b96 | |
|
|
b87f82f74d | |
|
|
ffad53a331 |
|
|
@ -20,6 +20,9 @@ import logging
|
|||
|
||||
from functools import reduce
|
||||
from datetime import datetime
|
||||
|
||||
import numpy as np
|
||||
|
||||
from numpy import sqrt
|
||||
from numpy import asarray
|
||||
|
||||
|
|
@ -119,21 +122,24 @@ class CustomPlot(PamhyrPlot):
|
|||
else:
|
||||
z_min = reach.geometry.get_z_min()
|
||||
|
||||
table = results.get("table")
|
||||
id_ts = results.get_timestamp_id(self._current_timestamp)
|
||||
|
||||
q = list(
|
||||
map(
|
||||
lambda p: p.get_ts_key(self._current_timestamp, "Q"),
|
||||
lambda p: table["Q"][id_ts, p.global_index],
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
z = list(
|
||||
map(
|
||||
lambda p: p.get_ts_key(self._current_timestamp, "Z"),
|
||||
lambda p: table["Z"][id_ts, p.global_index],
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
v = list(
|
||||
map(
|
||||
lambda p: p.get_ts_key(self._current_timestamp, "V"),
|
||||
lambda p: table["V"][id_ts, p.global_index],
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -150,14 +156,15 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
if len(self.lines) != 0:
|
||||
self.lines = {}
|
||||
if "bed_elevation" in self._y:
|
||||
|
||||
if "bed_elevation" in self._y:
|
||||
ax = self._axes[unit["bed_elevation"]]
|
||||
if self._current_res_id < 2:
|
||||
if reach.has_bedload():
|
||||
dz = self.draw_bottom_with_bedload(reach)
|
||||
else:
|
||||
dz = z_min
|
||||
|
||||
line = ax.plot(
|
||||
rk, dz,
|
||||
color='grey', lw=1.,
|
||||
|
|
@ -199,7 +206,6 @@ class CustomPlot(PamhyrPlot):
|
|||
if (self._envelop and
|
||||
reach.has_bedload() and
|
||||
self._current_res_id < 2):
|
||||
|
||||
ax = self._axes[unit["bed_elevation_envelop"]]
|
||||
|
||||
e = list(
|
||||
|
|
@ -231,7 +237,6 @@ class CustomPlot(PamhyrPlot):
|
|||
# self.lines["bed_elevation_envelop"] = line2
|
||||
|
||||
if "water_elevation" in self._y:
|
||||
|
||||
ax = self._axes[unit["water_elevation"]]
|
||||
line = ax.plot(
|
||||
rk, z, lw=1.,
|
||||
|
|
@ -246,12 +251,11 @@ class CustomPlot(PamhyrPlot):
|
|||
)
|
||||
|
||||
if self._envelop:
|
||||
|
||||
ax = self._axes[unit["water_elevation_envelop"]]
|
||||
|
||||
d = list(
|
||||
map(
|
||||
lambda p: max(p.get_key("Z")),
|
||||
lambda p: np.max(table["Z"][:, p.global_index]),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -265,7 +269,7 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
d = list(
|
||||
map(
|
||||
lambda p: min(p.get_key("Z")),
|
||||
lambda p: np.min(table["Z"][:, p.global_index]),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -278,7 +282,6 @@ class CustomPlot(PamhyrPlot):
|
|||
# self.lines["water_elevation_envelop2"] = line2
|
||||
|
||||
if "discharge" in self._y:
|
||||
|
||||
ax = self._axes[unit["discharge"]]
|
||||
line = ax.plot(
|
||||
rk, q, lw=1.,
|
||||
|
|
@ -287,12 +290,11 @@ class CustomPlot(PamhyrPlot):
|
|||
self.lines["discharge"] = line
|
||||
|
||||
if self._envelop:
|
||||
|
||||
ax = self._axes[unit["discharge_envelop"]]
|
||||
|
||||
q1 = list(
|
||||
map(
|
||||
lambda p: max(p.get_key("Q")),
|
||||
lambda p: np.max(table["Q"][:, p.global_index]),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -305,7 +307,7 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
q2 = list(
|
||||
map(
|
||||
lambda p: min(p.get_key("Q")),
|
||||
lambda p: np.min(table["Q"][:, p.global_index]),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -317,7 +319,6 @@ class CustomPlot(PamhyrPlot):
|
|||
# self.lines["discharge_envelop2"] = line2
|
||||
|
||||
if "velocity" in self._y:
|
||||
|
||||
ax = self._axes[unit["velocity"]]
|
||||
|
||||
line = ax.plot(
|
||||
|
|
@ -330,7 +331,7 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
velocities = list(
|
||||
map(
|
||||
lambda p: p.get_key("V"),
|
||||
lambda p: table["V"][:, p.global_index],
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -354,13 +355,13 @@ class CustomPlot(PamhyrPlot):
|
|||
# self.lines["velocity_envelop2"] = line2
|
||||
|
||||
if "depth" in self._y:
|
||||
|
||||
ax = self._axes[unit["depth"]]
|
||||
if self._current_res_id < 2:
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -368,23 +369,22 @@ class CustomPlot(PamhyrPlot):
|
|||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
table["Z"][id_ts, p.global_index]),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
d = list(map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
))
|
||||
|
||||
line = ax.plot(
|
||||
rk, d,
|
||||
|
|
@ -393,7 +393,6 @@ class CustomPlot(PamhyrPlot):
|
|||
self.lines["depth"] = line
|
||||
|
||||
if self._envelop and self._current_res_id < 2:
|
||||
|
||||
ax = self._axes[unit["depth_envelop"]]
|
||||
|
||||
d = list(map(
|
||||
|
|
@ -411,7 +410,7 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
d = list(map(
|
||||
lambda p1, p2: p1 - p2, map(
|
||||
lambda p: min(p.get_key("Z")),
|
||||
lambda p: np.min(table["Z"][:, p.global_index]),
|
||||
reach.profiles
|
||||
), z_min)
|
||||
)
|
||||
|
|
@ -423,13 +422,13 @@ class CustomPlot(PamhyrPlot):
|
|||
# self.lines["depth_envelop2"] = line2
|
||||
|
||||
if "mean_depth" in self._y:
|
||||
|
||||
ax = self._axes[unit["mean_depth"]]
|
||||
if self._current_res_id < 2:
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -437,23 +436,23 @@ class CustomPlot(PamhyrPlot):
|
|||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
d = list(map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
))
|
||||
|
||||
line = ax.plot(
|
||||
rk, d,
|
||||
|
|
@ -462,18 +461,20 @@ class CustomPlot(PamhyrPlot):
|
|||
self.lines["mean_depth"] = line
|
||||
|
||||
if "froude" in self._y:
|
||||
|
||||
ax = self._axes[unit["froude"]]
|
||||
|
||||
if self._current_res_id < 2:
|
||||
fr = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._current_timestamp, "V") /
|
||||
table["V"][id_ts, p.global_index] /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(p.get_ts_key(
|
||||
self._current_timestamp, "Z")) /
|
||||
p.geometry.wet_width(p.get_ts_key(
|
||||
self._current_timestamp, "Z"))
|
||||
p.geometry.wet_area(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
) /
|
||||
p.geometry.wet_width(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
)
|
||||
)),
|
||||
reach.profiles
|
||||
)
|
||||
|
|
@ -482,12 +483,14 @@ class CustomPlot(PamhyrPlot):
|
|||
fr1 = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._current_timestamp, "V") /
|
||||
table["V"][id_ts, p.global_index] /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(p.get_ts_key(
|
||||
self._current_timestamp, "Z")) /
|
||||
p.geometry.wet_width(p.get_ts_key(
|
||||
self._current_timestamp, "Z"))
|
||||
p.geometry.wet_area(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
) /
|
||||
p.geometry.wet_width(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
)
|
||||
)),
|
||||
reach1.profiles
|
||||
)
|
||||
|
|
@ -495,12 +498,14 @@ class CustomPlot(PamhyrPlot):
|
|||
fr2 = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._current_timestamp, "V") /
|
||||
table["V"][id_ts, p.global_index] /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(p.get_ts_key(
|
||||
self._current_timestamp, "Z")) /
|
||||
p.geometry.wet_width(p.get_ts_key(
|
||||
self._current_timestamp, "Z"))
|
||||
p.geometry.wet_area(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
) /
|
||||
p.geometry.wet_width(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
)
|
||||
)),
|
||||
reach2.profiles
|
||||
)
|
||||
|
|
@ -524,7 +529,8 @@ class CustomPlot(PamhyrPlot):
|
|||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -532,14 +538,16 @@ class CustomPlot(PamhyrPlot):
|
|||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
import numpy as np
|
||||
|
||||
from functools import reduce
|
||||
|
||||
|
|
@ -167,14 +168,18 @@ class PlotRKC(PamhyrPlot):
|
|||
|
||||
def draw_water_elevation(self, reach):
|
||||
if len(reach.geometry.profiles) != 0:
|
||||
result = self.results[self._current_res_id]
|
||||
rk = reach.geometry.get_rk()
|
||||
z_min = reach.geometry.get_z_min()
|
||||
|
||||
table = result.get("table")["Z"]
|
||||
ts = result.get_timestamp_id(self._current_timestamp)
|
||||
|
||||
water_z = list(
|
||||
map(
|
||||
lambda p: p.get_ts_key(
|
||||
self._current_timestamp, "Z"
|
||||
),
|
||||
lambda p: table[
|
||||
ts, p.global_index
|
||||
],
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -194,12 +199,18 @@ class PlotRKC(PamhyrPlot):
|
|||
|
||||
def draw_water_elevation_max(self, reach):
|
||||
if len(reach.geometry.profiles) != 0:
|
||||
result = self.results[self._current_res_id]
|
||||
rk = reach.geometry.get_rk()
|
||||
z_min = reach.geometry.get_z_min()
|
||||
|
||||
table = result.get("table")["Z"]
|
||||
ts = result.get_timestamp_id(self._current_timestamp)
|
||||
|
||||
water_z = list(
|
||||
map(
|
||||
lambda p: max(p.get_key("Z")),
|
||||
lambda p: table[
|
||||
ts, p.global_index
|
||||
],
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -253,12 +264,14 @@ class PlotRKC(PamhyrPlot):
|
|||
|
||||
def draw_water_elevation_overflow(self, reach):
|
||||
overflow = []
|
||||
result = self.results[self._current_res_id]
|
||||
table = result.get("table")["Z"]
|
||||
|
||||
for profile in reach.profiles:
|
||||
z_max = max(profile.get_key("Z"))
|
||||
z_max = max(table[:, profile.global_index])
|
||||
z_max_ts = 0
|
||||
for ts in self._timestamps:
|
||||
z = profile.get_ts_key(ts, "Z")
|
||||
for i, ts in enumerate(self._timestamps):
|
||||
z = table[i, profile.global_index]
|
||||
if z == z_max:
|
||||
z_max_ts = ts
|
||||
break
|
||||
|
|
@ -329,16 +342,18 @@ class PlotRKC(PamhyrPlot):
|
|||
self.update()
|
||||
|
||||
def update_water_elevation(self):
|
||||
results = self.results[self._current_res_id]
|
||||
reach = results.river.reach(self._current_reach_id)
|
||||
result = self.results[self._current_res_id]
|
||||
reach = result.river.reach(self._current_reach_id)
|
||||
rk = reach.geometry.get_rk()
|
||||
z_min = reach.geometry.get_z_min()
|
||||
table = result.get("table")["Z"]
|
||||
ts = result.get_timestamp_id(self._current_timestamp)
|
||||
|
||||
water_z = list(
|
||||
map(
|
||||
lambda p: p.get_ts_key(
|
||||
self._current_timestamp, "Z"
|
||||
),
|
||||
lambda p: table[
|
||||
ts, p.global_index
|
||||
],
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -94,59 +94,64 @@ class TableModel(PamhyrTableModel):
|
|||
v = self._data[0].solver_name
|
||||
return str(v)
|
||||
elif self._opt_data == "raw_data":
|
||||
table = self._data[0].get("table")
|
||||
ts = self._data[0].get_timestamp_id(self._timestamp)
|
||||
|
||||
if self._headers[column] == "name":
|
||||
if p.name == "":
|
||||
return f"{p.rk:.4f}"
|
||||
return f"{p.name}"
|
||||
elif self._headers[column] == "water_elevation":
|
||||
v = p.get_ts_key(self._timestamp, "Z")
|
||||
v = table["Z"][ts, p.global_index]
|
||||
if v is None:
|
||||
v = 0.0
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "discharge":
|
||||
v = p.get_ts_key(self._timestamp, "Q")
|
||||
v = table["Q"][ts, p.global_index]
|
||||
if v is None:
|
||||
v = 0.0
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "velocity":
|
||||
v = p.get_ts_key(self._timestamp, "V")
|
||||
v = table["V"][ts, p.global_index]
|
||||
if v is None:
|
||||
v = 0.0
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "width":
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
z = table["Z"][ts, p.global_index]
|
||||
v = p.geometry.wet_width(z)
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "depth":
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
z = table["Z"][ts, p.global_index]
|
||||
v = p.geometry.max_water_depth(z)
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "mean_depth":
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
z = table["Z"][ts, p.global_index]
|
||||
v = p.geometry.mean_water_depth(z)
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "wet_area":
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
z = table["Z"][ts, p.global_index]
|
||||
v = p.geometry.wet_area(z)
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "wet_perimeter":
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
z = table["Z"][ts, p.global_index]
|
||||
v = p.geometry.wet_perimeter(z)
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "hydraulic_radius":
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
z = table["Z"][ts, p.global_index]
|
||||
v = p.geometry.wet_radius(z)
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "froude":
|
||||
q = p.get_ts_key(self._timestamp, "Q")
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
v = p.get_ts_key(self._timestamp, "V")
|
||||
q = table["Q"][ts, p.global_index]
|
||||
z = table["Z"][ts, p.global_index]
|
||||
v = table["V"][ts, p.global_index]
|
||||
a = p.geometry.wet_area(z)
|
||||
b = p.geometry.wet_width(z)
|
||||
|
||||
if b == 0.0 or a == 0.0:
|
||||
froude = 0.0
|
||||
else:
|
||||
froude = v / sqrt(9.81 * (a / b))
|
||||
|
||||
return f"{froude:.4f}"
|
||||
else:
|
||||
v = 0.0
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ except Exception as e:
|
|||
|
||||
from functools import reduce
|
||||
|
||||
import numpy as np
|
||||
from numpy import sqrt
|
||||
|
||||
from datetime import datetime
|
||||
|
|
@ -872,14 +873,25 @@ class ResultsWindow(PamhyrWindow):
|
|||
reach = results.river.reachs[self._get_current_reach()]
|
||||
dict_x = self._trad.get_dict("values_x")
|
||||
dict_y = self._trad.get_dict("values_y")
|
||||
|
||||
if self._current_results == 2:
|
||||
envelop = False
|
||||
reach1 = results[0].river.reachs[self._get_current_reach()]
|
||||
reach2 = results[1].river.reachs[self._get_current_reach()]
|
||||
|
||||
if envelop:
|
||||
dict_y.update(self._trad.get_dict("values_y_envelop"))
|
||||
|
||||
my_dict = {}
|
||||
my_dict[dict_x["rk"]] = reach.geometry.get_rk()
|
||||
|
||||
table = results.get("table")
|
||||
id_ts = results.get_timestamp_id(timestamp)
|
||||
|
||||
z = table["Z"]
|
||||
q = table["Q"]
|
||||
v = table["V"]
|
||||
|
||||
if "bed_elevation" in y:
|
||||
if reach.has_bedload():
|
||||
zmin = list(
|
||||
|
|
@ -897,40 +909,40 @@ class ResultsWindow(PamhyrWindow):
|
|||
if "discharge" in y:
|
||||
my_dict[dict_y["discharge"]] = list(
|
||||
map(
|
||||
lambda p: p.get_ts_key(timestamp, "Q"),
|
||||
lambda p: q[id_ts, p.global_index],
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
if envelop:
|
||||
my_dict[dict_y["min_discharge"]] = list(
|
||||
map(
|
||||
lambda p: min(p.get_key("Q")),
|
||||
lambda p: np.min(q[:, p.global_index]),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
my_dict[dict_y["max_discharge"]] = list(
|
||||
map(
|
||||
lambda p: max(p.get_key("Q")),
|
||||
lambda p: np.max(q[:, p.global_index]),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
if "water_elevation" in y:
|
||||
my_dict[dict_y["water_elevation"]] = list(
|
||||
map(
|
||||
lambda p: p.get_ts_key(timestamp, "Z"),
|
||||
lambda p: z[id_ts, p.global_index],
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
if envelop:
|
||||
my_dict[dict_y["min_water_elevation"]] = list(
|
||||
map(
|
||||
lambda p: min(p.get_key("Z")),
|
||||
lambda p: np.min(z[:, p.global_index]),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
my_dict[dict_y["max_water_elevation"]] = list(
|
||||
map(
|
||||
lambda p: max(p.get_key("Z")),
|
||||
lambda p: np.max(z[:, p.global_index]),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -938,16 +950,15 @@ class ResultsWindow(PamhyrWindow):
|
|||
if "velocity" in y:
|
||||
my_dict[dict_y["velocity"]] = list(
|
||||
map(
|
||||
lambda p: p.get_ts_key(timestamp, "V"),
|
||||
lambda p: v[id_ts, p.global_index],
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
if envelop:
|
||||
velocities = list(map(
|
||||
lambda p: p.get_key("V"),
|
||||
lambda p: v[:, p.global_index],
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
))
|
||||
my_dict[dict_y["min_velocity"]] = [min(v) for v in velocities]
|
||||
my_dict[dict_y["max_velocity"]] = [max(v) for v in velocities]
|
||||
|
||||
|
|
@ -956,7 +967,8 @@ class ResultsWindow(PamhyrWindow):
|
|||
d = my_dict[dict_y["depth"]] = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -964,14 +976,16 @@ class ResultsWindow(PamhyrWindow):
|
|||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -985,14 +999,14 @@ class ResultsWindow(PamhyrWindow):
|
|||
if envelop:
|
||||
my_dict[dict_y["min_depth"]] = list(map(
|
||||
lambda p1, p2: p1 - p2, map(
|
||||
lambda p: min(p.get_key("Z")),
|
||||
lambda p: np.min(z[:, p.global_index]),
|
||||
reach.profiles
|
||||
), reach.geometry.get_z_min()
|
||||
)
|
||||
)
|
||||
my_dict[dict_y["max_depth"]] = list(map(
|
||||
lambda p1, p2: p1 - p2, map(
|
||||
lambda p: max(p.get_key("Z")),
|
||||
lambda p: np.max(z[:, p.global_index]),
|
||||
reach.profiles
|
||||
), reach.geometry.get_z_min()
|
||||
)
|
||||
|
|
@ -1003,7 +1017,8 @@ class ResultsWindow(PamhyrWindow):
|
|||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -1011,14 +1026,16 @@ class ResultsWindow(PamhyrWindow):
|
|||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -1033,57 +1050,65 @@ class ResultsWindow(PamhyrWindow):
|
|||
if self._current_results != 2:
|
||||
fr = my_dict[dict_y["froude"]] = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(timestamp, "V") /
|
||||
lambda p: (
|
||||
v[id_ts, p.global_index] /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
p.get_ts_key(timestamp, "Z")) /
|
||||
z[id_ts, p.global_index]
|
||||
) /
|
||||
p.geometry.wet_width(
|
||||
p.get_ts_key(timestamp, "Z"))
|
||||
)),
|
||||
z[id_ts, p.global_index]
|
||||
)
|
||||
))
|
||||
),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
else:
|
||||
fr1 = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(timestamp, "V") /
|
||||
lambda p: (
|
||||
v[id_ts, p.global_index] /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
p.get_ts_key(timestamp, "Z")) /
|
||||
z[id_ts, p.global_index]
|
||||
) /
|
||||
p.geometry.wet_width(
|
||||
p.get_ts_key(timestamp, "Z"))
|
||||
)),
|
||||
z[id_ts, p.global_index]
|
||||
)
|
||||
))
|
||||
),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
fr2 = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(timestamp, "V") /
|
||||
lambda p: (
|
||||
v[id_ts, p.global_index] /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
p.get_ts_key(timestamp, "Z")) /
|
||||
z[id_ts, p.global_index]
|
||||
) /
|
||||
p.geometry.wet_width(
|
||||
p.get_ts_key(timestamp, "Z"))
|
||||
)),
|
||||
z[id_ts, p.global_index]
|
||||
)
|
||||
))
|
||||
),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
fr = list(
|
||||
map(
|
||||
fr = list(map(
|
||||
lambda x, y: x - y,
|
||||
fr1, fr2
|
||||
)
|
||||
)
|
||||
))
|
||||
my_dict[dict_y["froude"]] = fr
|
||||
if "wet_area" in y:
|
||||
if self._current_results != 2:
|
||||
wa = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -1091,23 +1116,24 @@ class ResultsWindow(PamhyrWindow):
|
|||
wa1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
wa2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
wa = list(
|
||||
map(
|
||||
wa = list(map(
|
||||
lambda x, y: x - y,
|
||||
wa1, wa2
|
||||
)
|
||||
)
|
||||
))
|
||||
|
||||
my_dict[dict_y["wet_area"]] = wa
|
||||
|
||||
return my_dict
|
||||
|
|
@ -1118,24 +1144,38 @@ class ResultsWindow(PamhyrWindow):
|
|||
profile = reach.profile(profile)
|
||||
dict_x = self._trad.get_dict("values_x")
|
||||
dict_y = self._trad.get_dict("values_y")
|
||||
|
||||
my_dict = {}
|
||||
my_dict[dict_x["time"]] = self._timestamps
|
||||
z = profile.get_key("Z")
|
||||
q = profile.get_key("Q")
|
||||
v = profile.get_key("V")
|
||||
|
||||
table = results.get("table")
|
||||
|
||||
z = table["Z"][:, profile.global_index]
|
||||
q = table["Q"][:, profile.global_index]
|
||||
v = table["V"][:, profile.global_index]
|
||||
|
||||
if self._current_results == 2:
|
||||
reach1 = self._results[0].river.reach(self._reach)
|
||||
reach2 = self._results[1].river.reach(self._reach)
|
||||
reach3 = self._results[2].river.reach(self._reach)
|
||||
profile1 = reach1.profile(self._profile)
|
||||
profile2 = reach2.profile(self._profile)
|
||||
profile3 = reach3.profile(self._profile)
|
||||
# profile3 = reach3.profile(self._profile)
|
||||
|
||||
z1 = table["Z"][:, profile1.global_index]
|
||||
q1 = table["Q"][:, profile1.global_index]
|
||||
v1 = table["V"][:, profile1.global_index]
|
||||
|
||||
z2 = table["Z"][:, profile2.global_index]
|
||||
q2 = table["Q"][:, profile2.global_index]
|
||||
v2 = table["V"][:, profile2.global_index]
|
||||
|
||||
if "bed_elevation" in y:
|
||||
if reach.has_bedload():
|
||||
z_min = profile.get_key("zfd")
|
||||
else:
|
||||
z_min = [profile.geometry.z_min()] * len(self._timestamps)
|
||||
|
||||
my_dict[dict_y["bed_elevation"]] = z_min
|
||||
if "discharge" in y:
|
||||
my_dict[dict_y["discharge"]] = q
|
||||
|
|
@ -1146,14 +1186,14 @@ class ResultsWindow(PamhyrWindow):
|
|||
if "depth" in y:
|
||||
if self._current_results != 2:
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.max_water_depth(z), z)
|
||||
map(lambda x: profile.geometry.max_water_depth(x), z)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(lambda z: profile1.geometry.max_water_depth(z), z1)
|
||||
map(lambda x: profile1.geometry.max_water_depth(x), z1)
|
||||
)
|
||||
d2 = list(
|
||||
map(lambda z: profile2.geometry.max_water_depth(z), z2)
|
||||
map(lambda x: profile2.geometry.max_water_depth(x), z2)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
|
|
@ -1165,21 +1205,19 @@ class ResultsWindow(PamhyrWindow):
|
|||
if "mean_depth" in y:
|
||||
if self._current_results != 2:
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.mean_water_depth(z), z)
|
||||
map(lambda x: profile.geometry.mean_water_depth(x), z)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(lambda z: profile1.geometry.mean_water_depth(z), z1)
|
||||
map(lambda x: profile1.geometry.mean_water_depth(x), z1)
|
||||
)
|
||||
d2 = list(
|
||||
map(lambda z: profile2.geometry.mean_water_depth(z), z2)
|
||||
map(lambda x: profile2.geometry.mean_water_depth(x), z2)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
d = list(map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
))
|
||||
my_dict[dict_y["mean_depth"]] = d
|
||||
if "froude" in y:
|
||||
if self._current_results != 2:
|
||||
|
|
@ -1188,7 +1226,8 @@ class ResultsWindow(PamhyrWindow):
|
|||
v / sqrt(9.81 * (
|
||||
profile.geometry.wet_area(z) /
|
||||
profile.geometry.wet_width(z))
|
||||
), z, v)
|
||||
),
|
||||
z, v)
|
||||
)
|
||||
else:
|
||||
fr1 = list(
|
||||
|
|
@ -1197,7 +1236,8 @@ class ResultsWindow(PamhyrWindow):
|
|||
sqrt(9.81 * (
|
||||
profile1.geometry.wet_area(z) /
|
||||
profile1.geometry.wet_width(z))
|
||||
), z1, v1)
|
||||
),
|
||||
z1, v1)
|
||||
)
|
||||
fr2 = list(
|
||||
map(lambda z, v:
|
||||
|
|
@ -1205,33 +1245,30 @@ class ResultsWindow(PamhyrWindow):
|
|||
sqrt(9.81 * (
|
||||
profile2.geometry.wet_area(z) /
|
||||
profile2.geometry.wet_width(z))
|
||||
), z2, v2)
|
||||
),
|
||||
z2, v2)
|
||||
)
|
||||
fr = list(
|
||||
map(
|
||||
fr = list(map(
|
||||
lambda x, y: x - y,
|
||||
fr1, fr2
|
||||
)
|
||||
)
|
||||
))
|
||||
my_dict[dict_y["froude"]] = fr
|
||||
if "wet_area" in y:
|
||||
if self._current_results != 2:
|
||||
wa = list(
|
||||
map(lambda z: profile.geometry.wet_area(z), z)
|
||||
map(lambda x: profile.geometry.wet_area(x), z)
|
||||
)
|
||||
else:
|
||||
wa1 = list(
|
||||
map(lambda z: profile1.geometry.wet_area(z), z1)
|
||||
map(lambda x: profile1.geometry.wet_area(x), z1)
|
||||
)
|
||||
wa2 = list(
|
||||
map(lambda z: profile2.geometry.wet_area(z), z2)
|
||||
map(lambda x: profile2.geometry.wet_area(x), z2)
|
||||
)
|
||||
wa = list(
|
||||
map(
|
||||
wa = list(map(
|
||||
lambda x, y: x - y,
|
||||
wa1, wa2
|
||||
)
|
||||
)
|
||||
))
|
||||
my_dict[dict_y["wet_area"]] = wa
|
||||
|
||||
return my_dict
|
||||
|
|
|
|||
Loading…
Reference in New Issue