mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
No commits in common. "3e094af325e197daf0837262659fd9b9a08b927f" and "662a218e4109e364ef2f384e7d1968fb5e8e92c9" have entirely different histories.
3e094af325
...
662a218e41
|
|
@ -20,9 +20,6 @@ import logging
|
|||
|
||||
from functools import reduce
|
||||
from datetime import datetime
|
||||
|
||||
import numpy as np
|
||||
|
||||
from numpy import sqrt
|
||||
from numpy import asarray
|
||||
|
||||
|
|
@ -122,24 +119,21 @@ 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: table["Q"][id_ts, p.global_index],
|
||||
lambda p: p.get_ts_key(self._current_timestamp, "Q"),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
z = list(
|
||||
map(
|
||||
lambda p: table["Z"][id_ts, p.global_index],
|
||||
lambda p: p.get_ts_key(self._current_timestamp, "Z"),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
v = list(
|
||||
map(
|
||||
lambda p: table["V"][id_ts, p.global_index],
|
||||
lambda p: p.get_ts_key(self._current_timestamp, "V"),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -156,15 +150,14 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
if len(self.lines) != 0:
|
||||
self.lines = {}
|
||||
|
||||
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.,
|
||||
|
|
@ -206,6 +199,7 @@ 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(
|
||||
|
|
@ -237,6 +231,7 @@ 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.,
|
||||
|
|
@ -251,11 +246,12 @@ class CustomPlot(PamhyrPlot):
|
|||
)
|
||||
|
||||
if self._envelop:
|
||||
|
||||
ax = self._axes[unit["water_elevation_envelop"]]
|
||||
|
||||
d = list(
|
||||
map(
|
||||
lambda p: np.max(table["Z"][:, p.global_index]),
|
||||
lambda p: max(p.get_key("Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -269,7 +265,7 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
d = list(
|
||||
map(
|
||||
lambda p: np.min(table["Z"][:, p.global_index]),
|
||||
lambda p: min(p.get_key("Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -282,6 +278,7 @@ 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.,
|
||||
|
|
@ -290,11 +287,12 @@ class CustomPlot(PamhyrPlot):
|
|||
self.lines["discharge"] = line
|
||||
|
||||
if self._envelop:
|
||||
|
||||
ax = self._axes[unit["discharge_envelop"]]
|
||||
|
||||
q1 = list(
|
||||
map(
|
||||
lambda p: np.max(table["Q"][:, p.global_index]),
|
||||
lambda p: max(p.get_key("Q")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -307,7 +305,7 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
q2 = list(
|
||||
map(
|
||||
lambda p: np.min(table["Q"][:, p.global_index]),
|
||||
lambda p: min(p.get_key("Q")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -319,6 +317,7 @@ class CustomPlot(PamhyrPlot):
|
|||
# self.lines["discharge_envelop2"] = line2
|
||||
|
||||
if "velocity" in self._y:
|
||||
|
||||
ax = self._axes[unit["velocity"]]
|
||||
|
||||
line = ax.plot(
|
||||
|
|
@ -331,7 +330,7 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
velocities = list(
|
||||
map(
|
||||
lambda p: table["V"][:, p.global_index],
|
||||
lambda p: p.get_key("V"),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -355,13 +354,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(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -369,22 +368,23 @@ class CustomPlot(PamhyrPlot):
|
|||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
table["Z"][id_ts, p.global_index]),
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
d = list(map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
))
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
line = ax.plot(
|
||||
rk, d,
|
||||
|
|
@ -393,6 +393,7 @@ 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(
|
||||
|
|
@ -410,7 +411,7 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
d = list(map(
|
||||
lambda p1, p2: p1 - p2, map(
|
||||
lambda p: np.min(table["Z"][:, p.global_index]),
|
||||
lambda p: min(p.get_key("Z")),
|
||||
reach.profiles
|
||||
), z_min)
|
||||
)
|
||||
|
|
@ -422,13 +423,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(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -436,23 +437,23 @@ class CustomPlot(PamhyrPlot):
|
|||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
d = list(map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
))
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
line = ax.plot(
|
||||
rk, d,
|
||||
|
|
@ -461,21 +462,19 @@ class CustomPlot(PamhyrPlot):
|
|||
self.lines["mean_depth"] = line
|
||||
|
||||
if "froude" in self._y:
|
||||
ax = self._axes[unit["froude"]]
|
||||
|
||||
ax = self._axes[unit["froude"]]
|
||||
if self._current_res_id < 2:
|
||||
fr = list(
|
||||
map(
|
||||
lambda p:
|
||||
table["V"][id_ts, p.global_index] /
|
||||
p.get_ts_key(self._current_timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
) /
|
||||
p.geometry.wet_width(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
)
|
||||
)),
|
||||
p.geometry.wet_area(p.get_ts_key(
|
||||
self._current_timestamp, "Z")) /
|
||||
p.geometry.wet_width(p.get_ts_key(
|
||||
self._current_timestamp, "Z"))
|
||||
)),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -483,30 +482,26 @@ class CustomPlot(PamhyrPlot):
|
|||
fr1 = list(
|
||||
map(
|
||||
lambda p:
|
||||
table["V"][id_ts, p.global_index] /
|
||||
p.get_ts_key(self._current_timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
) /
|
||||
p.geometry.wet_width(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
)
|
||||
)),
|
||||
p.geometry.wet_area(p.get_ts_key(
|
||||
self._current_timestamp, "Z")) /
|
||||
p.geometry.wet_width(p.get_ts_key(
|
||||
self._current_timestamp, "Z"))
|
||||
)),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
fr2 = list(
|
||||
map(
|
||||
lambda p:
|
||||
table["V"][id_ts, p.global_index] /
|
||||
p.get_ts_key(self._current_timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
) /
|
||||
p.geometry.wet_width(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
)
|
||||
)),
|
||||
p.geometry.wet_area(p.get_ts_key(
|
||||
self._current_timestamp, "Z")) /
|
||||
p.geometry.wet_width(p.get_ts_key(
|
||||
self._current_timestamp, "Z"))
|
||||
)),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -529,8 +524,7 @@ class CustomPlot(PamhyrPlot):
|
|||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -538,16 +532,14 @@ class CustomPlot(PamhyrPlot):
|
|||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
table["Z"][id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(self._current_timestamp, "Z")),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
import numpy as np
|
||||
|
||||
from functools import reduce
|
||||
|
||||
|
|
@ -168,18 +167,14 @@ 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: table[
|
||||
ts, p.global_index
|
||||
],
|
||||
lambda p: p.get_ts_key(
|
||||
self._current_timestamp, "Z"
|
||||
),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -199,18 +194,12 @@ 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: table[
|
||||
ts, p.global_index
|
||||
],
|
||||
lambda p: max(p.get_key("Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -264,14 +253,12 @@ 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(table[:, profile.global_index])
|
||||
z_max = max(profile.get_key("Z"))
|
||||
z_max_ts = 0
|
||||
for i, ts in enumerate(self._timestamps):
|
||||
z = table[i, profile.global_index]
|
||||
for ts in self._timestamps:
|
||||
z = profile.get_ts_key(ts, "Z")
|
||||
if z == z_max:
|
||||
z_max_ts = ts
|
||||
break
|
||||
|
|
@ -342,18 +329,16 @@ class PlotRKC(PamhyrPlot):
|
|||
self.update()
|
||||
|
||||
def update_water_elevation(self):
|
||||
result = self.results[self._current_res_id]
|
||||
reach = result.river.reach(self._current_reach_id)
|
||||
results = self.results[self._current_res_id]
|
||||
reach = results.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: table[
|
||||
ts, p.global_index
|
||||
],
|
||||
lambda p: p.get_ts_key(
|
||||
self._current_timestamp, "Z"
|
||||
),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -94,64 +94,59 @@ 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 = table["Z"][ts, p.global_index]
|
||||
v = p.get_ts_key(self._timestamp, "Z")
|
||||
if v is None:
|
||||
v = 0.0
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "discharge":
|
||||
v = table["Q"][ts, p.global_index]
|
||||
v = p.get_ts_key(self._timestamp, "Q")
|
||||
if v is None:
|
||||
v = 0.0
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "velocity":
|
||||
v = table["V"][ts, p.global_index]
|
||||
v = p.get_ts_key(self._timestamp, "V")
|
||||
if v is None:
|
||||
v = 0.0
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "width":
|
||||
z = table["Z"][ts, p.global_index]
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
v = p.geometry.wet_width(z)
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "depth":
|
||||
z = table["Z"][ts, p.global_index]
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
v = p.geometry.max_water_depth(z)
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "mean_depth":
|
||||
z = table["Z"][ts, p.global_index]
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
v = p.geometry.mean_water_depth(z)
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "wet_area":
|
||||
z = table["Z"][ts, p.global_index]
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
v = p.geometry.wet_area(z)
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "wet_perimeter":
|
||||
z = table["Z"][ts, p.global_index]
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
v = p.geometry.wet_perimeter(z)
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "hydraulic_radius":
|
||||
z = table["Z"][ts, p.global_index]
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
v = p.geometry.wet_radius(z)
|
||||
return f"{v:.4f}"
|
||||
elif self._headers[column] == "froude":
|
||||
q = table["Q"][ts, p.global_index]
|
||||
z = table["Z"][ts, p.global_index]
|
||||
v = table["V"][ts, p.global_index]
|
||||
q = p.get_ts_key(self._timestamp, "Q")
|
||||
z = p.get_ts_key(self._timestamp, "Z")
|
||||
v = p.get_ts_key(self._timestamp, "V")
|
||||
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,7 +33,6 @@ except Exception as e:
|
|||
|
||||
from functools import reduce
|
||||
|
||||
import numpy as np
|
||||
from numpy import sqrt
|
||||
|
||||
from datetime import datetime
|
||||
|
|
@ -873,25 +872,14 @@ 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(
|
||||
|
|
@ -909,40 +897,40 @@ class ResultsWindow(PamhyrWindow):
|
|||
if "discharge" in y:
|
||||
my_dict[dict_y["discharge"]] = list(
|
||||
map(
|
||||
lambda p: q[id_ts, p.global_index],
|
||||
lambda p: p.get_ts_key(timestamp, "Q"),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
if envelop:
|
||||
my_dict[dict_y["min_discharge"]] = list(
|
||||
map(
|
||||
lambda p: np.min(q[:, p.global_index]),
|
||||
lambda p: min(p.get_key("Q")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
my_dict[dict_y["max_discharge"]] = list(
|
||||
map(
|
||||
lambda p: np.max(q[:, p.global_index]),
|
||||
lambda p: max(p.get_key("Q")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
if "water_elevation" in y:
|
||||
my_dict[dict_y["water_elevation"]] = list(
|
||||
map(
|
||||
lambda p: z[id_ts, p.global_index],
|
||||
lambda p: p.get_ts_key(timestamp, "Z"),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
if envelop:
|
||||
my_dict[dict_y["min_water_elevation"]] = list(
|
||||
map(
|
||||
lambda p: np.min(z[:, p.global_index]),
|
||||
lambda p: min(p.get_key("Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
my_dict[dict_y["max_water_elevation"]] = list(
|
||||
map(
|
||||
lambda p: np.max(z[:, p.global_index]),
|
||||
lambda p: max(p.get_key("Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -950,15 +938,16 @@ class ResultsWindow(PamhyrWindow):
|
|||
if "velocity" in y:
|
||||
my_dict[dict_y["velocity"]] = list(
|
||||
map(
|
||||
lambda p: v[id_ts, p.global_index],
|
||||
lambda p: p.get_ts_key(timestamp, "V"),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
if envelop:
|
||||
velocities = list(map(
|
||||
lambda p: v[:, p.global_index],
|
||||
reach.profiles
|
||||
))
|
||||
lambda p: p.get_key("V"),
|
||||
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]
|
||||
|
||||
|
|
@ -967,8 +956,7 @@ class ResultsWindow(PamhyrWindow):
|
|||
d = my_dict[dict_y["depth"]] = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -976,16 +964,14 @@ class ResultsWindow(PamhyrWindow):
|
|||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -999,14 +985,14 @@ class ResultsWindow(PamhyrWindow):
|
|||
if envelop:
|
||||
my_dict[dict_y["min_depth"]] = list(map(
|
||||
lambda p1, p2: p1 - p2, map(
|
||||
lambda p: np.min(z[:, p.global_index]),
|
||||
lambda p: min(p.get_key("Z")),
|
||||
reach.profiles
|
||||
), reach.geometry.get_z_min()
|
||||
)
|
||||
)
|
||||
my_dict[dict_y["max_depth"]] = list(map(
|
||||
lambda p1, p2: p1 - p2, map(
|
||||
lambda p: np.max(z[:, p.global_index]),
|
||||
lambda p: max(p.get_key("Z")),
|
||||
reach.profiles
|
||||
), reach.geometry.get_z_min()
|
||||
)
|
||||
|
|
@ -1017,8 +1003,7 @@ class ResultsWindow(PamhyrWindow):
|
|||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -1026,16 +1011,14 @@ class ResultsWindow(PamhyrWindow):
|
|||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -1050,65 +1033,57 @@ class ResultsWindow(PamhyrWindow):
|
|||
if self._current_results != 2:
|
||||
fr = my_dict[dict_y["froude"]] = list(
|
||||
map(
|
||||
lambda p: (
|
||||
v[id_ts, p.global_index] /
|
||||
lambda p:
|
||||
p.get_ts_key(timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
z[id_ts, p.global_index]
|
||||
) /
|
||||
p.get_ts_key(timestamp, "Z")) /
|
||||
p.geometry.wet_width(
|
||||
z[id_ts, p.global_index]
|
||||
)
|
||||
))
|
||||
),
|
||||
p.get_ts_key(timestamp, "Z"))
|
||||
)),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
else:
|
||||
fr1 = list(
|
||||
map(
|
||||
lambda p: (
|
||||
v[id_ts, p.global_index] /
|
||||
lambda p:
|
||||
p.get_ts_key(timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
z[id_ts, p.global_index]
|
||||
) /
|
||||
p.get_ts_key(timestamp, "Z")) /
|
||||
p.geometry.wet_width(
|
||||
z[id_ts, p.global_index]
|
||||
)
|
||||
))
|
||||
),
|
||||
p.get_ts_key(timestamp, "Z"))
|
||||
)),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
fr2 = list(
|
||||
map(
|
||||
lambda p: (
|
||||
v[id_ts, p.global_index] /
|
||||
lambda p:
|
||||
p.get_ts_key(timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
z[id_ts, p.global_index]
|
||||
) /
|
||||
p.get_ts_key(timestamp, "Z")) /
|
||||
p.geometry.wet_width(
|
||||
z[id_ts, p.global_index]
|
||||
)
|
||||
))
|
||||
),
|
||||
p.get_ts_key(timestamp, "Z"))
|
||||
)),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
fr = list(map(
|
||||
lambda x, y: x - y,
|
||||
fr1, fr2
|
||||
))
|
||||
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(
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -1116,24 +1091,23 @@ class ResultsWindow(PamhyrWindow):
|
|||
wa1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
wa2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
z[id_ts, p.global_index]
|
||||
),
|
||||
p.get_ts_key(timestamp, "Z")),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
wa = list(map(
|
||||
lambda x, y: x - y,
|
||||
wa1, wa2
|
||||
))
|
||||
|
||||
wa = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
wa1, wa2
|
||||
)
|
||||
)
|
||||
my_dict[dict_y["wet_area"]] = wa
|
||||
|
||||
return my_dict
|
||||
|
|
@ -1144,38 +1118,24 @@ 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
|
||||
|
||||
table = results.get("table")
|
||||
|
||||
z = table["Z"][:, profile.global_index]
|
||||
q = table["Q"][:, profile.global_index]
|
||||
v = table["V"][:, profile.global_index]
|
||||
|
||||
z = profile.get_key("Z")
|
||||
q = profile.get_key("Q")
|
||||
v = profile.get_key("V")
|
||||
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)
|
||||
|
||||
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]
|
||||
profile3 = reach3.profile(self._profile)
|
||||
|
||||
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
|
||||
|
|
@ -1186,14 +1146,14 @@ class ResultsWindow(PamhyrWindow):
|
|||
if "depth" in y:
|
||||
if self._current_results != 2:
|
||||
d = list(
|
||||
map(lambda x: profile.geometry.max_water_depth(x), z)
|
||||
map(lambda z: profile.geometry.max_water_depth(z), z)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(lambda x: profile1.geometry.max_water_depth(x), z1)
|
||||
map(lambda z: profile1.geometry.max_water_depth(z), z1)
|
||||
)
|
||||
d2 = list(
|
||||
map(lambda x: profile2.geometry.max_water_depth(x), z2)
|
||||
map(lambda z: profile2.geometry.max_water_depth(z), z2)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
|
|
@ -1205,19 +1165,21 @@ class ResultsWindow(PamhyrWindow):
|
|||
if "mean_depth" in y:
|
||||
if self._current_results != 2:
|
||||
d = list(
|
||||
map(lambda x: profile.geometry.mean_water_depth(x), z)
|
||||
map(lambda z: profile.geometry.mean_water_depth(z), z)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(lambda x: profile1.geometry.mean_water_depth(x), z1)
|
||||
map(lambda z: profile1.geometry.mean_water_depth(z), z1)
|
||||
)
|
||||
d2 = list(
|
||||
map(lambda x: profile2.geometry.mean_water_depth(x), z2)
|
||||
map(lambda z: profile2.geometry.mean_water_depth(z), z2)
|
||||
)
|
||||
d = list(map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
))
|
||||
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:
|
||||
|
|
@ -1226,8 +1188,7 @@ class ResultsWindow(PamhyrWindow):
|
|||
v / sqrt(9.81 * (
|
||||
profile.geometry.wet_area(z) /
|
||||
profile.geometry.wet_width(z))
|
||||
),
|
||||
z, v)
|
||||
), z, v)
|
||||
)
|
||||
else:
|
||||
fr1 = list(
|
||||
|
|
@ -1236,8 +1197,7 @@ 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:
|
||||
|
|
@ -1245,30 +1205,33 @@ class ResultsWindow(PamhyrWindow):
|
|||
sqrt(9.81 * (
|
||||
profile2.geometry.wet_area(z) /
|
||||
profile2.geometry.wet_width(z))
|
||||
),
|
||||
z2, v2)
|
||||
), z2, v2)
|
||||
)
|
||||
fr = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
fr1, fr2
|
||||
)
|
||||
)
|
||||
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 x: profile.geometry.wet_area(x), z)
|
||||
map(lambda z: profile.geometry.wet_area(z), z)
|
||||
)
|
||||
else:
|
||||
wa1 = list(
|
||||
map(lambda x: profile1.geometry.wet_area(x), z1)
|
||||
map(lambda z: profile1.geometry.wet_area(z), z1)
|
||||
)
|
||||
wa2 = list(
|
||||
map(lambda x: profile2.geometry.wet_area(x), z2)
|
||||
map(lambda z: profile2.geometry.wet_area(z), z2)
|
||||
)
|
||||
wa = list(map(
|
||||
lambda x, y: x - y,
|
||||
wa1, wa2
|
||||
))
|
||||
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