mirror of https://gitlab.com/pamhyr/pamhyr2
debug custom plots (compare resuts)
parent
8daf89d1c4
commit
e47edea63b
|
|
@ -85,6 +85,7 @@ class CustomPlot(PamhyrPlot):
|
|||
)
|
||||
|
||||
self._axes = {}
|
||||
self.lines = {}
|
||||
|
||||
def draw_bottom_with_bedload(self, reach):
|
||||
self._bedrock = self.sl_compute_bedrock(reach)
|
||||
|
|
@ -171,6 +172,9 @@ class CustomPlot(PamhyrPlot):
|
|||
def _draw_rk(self):
|
||||
results = self.data[self._current_res_id]
|
||||
reach = results.river.reach(self._reach)
|
||||
if self._current_res_id == 2: # compare results
|
||||
reach1 = self.data[0].river.reach(self._reach)
|
||||
reach2 = self.data[1].river.reach(self._reach)
|
||||
rk = reach.geometry.get_rk()
|
||||
if reach.has_sediment():
|
||||
z_min = self.draw_bottom_with_bedload(reach)
|
||||
|
|
@ -206,7 +210,8 @@ class CustomPlot(PamhyrPlot):
|
|||
self._axes[ax].spines['right'].set_position(('outward', shift))
|
||||
shift += 60
|
||||
|
||||
self.lines = {}
|
||||
if len(self.lines) != 0:
|
||||
self.lines = {}
|
||||
if "bed_elevation" in self._y:
|
||||
|
||||
ax = self._axes[unit["bed_elevation"]]
|
||||
|
|
@ -255,7 +260,7 @@ class CustomPlot(PamhyrPlot):
|
|||
)
|
||||
self.lines["water_elevation"] = line
|
||||
|
||||
if "bed_elevation" in self._y:
|
||||
if "bed_elevation" in self._y and self._current_res_id != 2:
|
||||
self.fill = ax.fill_between(
|
||||
rk, z_min, z,
|
||||
color='blue', alpha=0.5, interpolate=True
|
||||
|
|
@ -372,20 +377,43 @@ class CustomPlot(PamhyrPlot):
|
|||
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
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
line = ax.plot(
|
||||
rk, d,
|
||||
color='brown', lw=1.,
|
||||
)
|
||||
self.lines["depth"] = line
|
||||
|
||||
if self._envelop:
|
||||
if self._envelop and self._current_res_id != 2:
|
||||
|
||||
ax = self._axes[unit["depth_envelop"]]
|
||||
|
||||
|
|
@ -418,13 +446,35 @@ class CustomPlot(PamhyrPlot):
|
|||
if "mean_depth" in self._y:
|
||||
|
||||
ax = self._axes[unit["mean_depth"]]
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach.profiles
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
line = ax.plot(
|
||||
rk, d,
|
||||
|
|
@ -435,19 +485,53 @@ class CustomPlot(PamhyrPlot):
|
|||
if "froude" in self._y:
|
||||
|
||||
ax = self._axes[unit["froude"]]
|
||||
fr = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")) /
|
||||
p.geometry.wet_width(
|
||||
p.get_ts_key(self._timestamp, "Z"))
|
||||
)),
|
||||
reach.profiles
|
||||
if self._current_res_id != 2:
|
||||
fr = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")) /
|
||||
p.geometry.wet_width(
|
||||
p.get_ts_key(self._timestamp, "Z"))
|
||||
)),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
fr1 = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")) /
|
||||
p.geometry.wet_width(
|
||||
p.get_ts_key(self._timestamp, "Z"))
|
||||
)),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
fr2 = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")) /
|
||||
p.geometry.wet_width(
|
||||
p.get_ts_key(self._timestamp, "Z"))
|
||||
)),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
fr = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
fr1, fr2
|
||||
)
|
||||
)
|
||||
|
||||
line = ax.plot(
|
||||
rk, fr, color='black', linestyle='--', lw=1.,
|
||||
|
|
@ -457,13 +541,35 @@ class CustomPlot(PamhyrPlot):
|
|||
if "wet_area" in self._y:
|
||||
|
||||
ax = self._axes[unit["wet_area"]]
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach.profiles
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
line = ax.plot(
|
||||
rk, d,
|
||||
|
|
@ -483,6 +589,10 @@ class CustomPlot(PamhyrPlot):
|
|||
def _redraw_rk(self):
|
||||
results = self.data[self._current_res_id]
|
||||
reach = results.river.reach(self._reach)
|
||||
if self._current_res_id == 2: # compare results
|
||||
reach1 = self.data[0].river.reach(self._reach)
|
||||
reach2 = self.data[1].river.reach(self._reach)
|
||||
|
||||
rk = reach.geometry.get_rk()
|
||||
z_min = reach.geometry.get_z_min()
|
||||
if reach.has_sediment():
|
||||
|
|
@ -514,7 +624,7 @@ class CustomPlot(PamhyrPlot):
|
|||
if "water_elevation" in self._y:
|
||||
self.lines["water_elevation"][0].set_ydata(z)
|
||||
|
||||
if "bed_elevation" in self._y:
|
||||
if "bed_elevation" in self._y and self._current_res_id != 2:
|
||||
ax = self._axes[unit["water_elevation"]]
|
||||
self.fill.remove()
|
||||
self.fill = ax.fill_between(
|
||||
|
|
@ -529,49 +639,153 @@ class CustomPlot(PamhyrPlot):
|
|||
self.lines["velocity"][0].set_ydata(v)
|
||||
|
||||
if "depth" in self._y:
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach.profiles
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.max_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
self.lines["depth"][0].set_ydata(d)
|
||||
|
||||
if "mean_depth" in self._y:
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach.profiles
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.mean_water_depth(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
self.lines["mean_depth"][0].set_ydata(d)
|
||||
|
||||
if "froude" in self._y:
|
||||
fr = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")) /
|
||||
p.geometry.wet_width(
|
||||
p.get_ts_key(self._timestamp, "Z"))
|
||||
)),
|
||||
reach.profiles
|
||||
if self._current_res_id != 2:
|
||||
fr = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")) /
|
||||
p.geometry.wet_width(
|
||||
p.get_ts_key(self._timestamp, "Z"))
|
||||
)),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
fr1 = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")) /
|
||||
p.geometry.wet_width(
|
||||
p.get_ts_key(self._timestamp, "Z"))
|
||||
)),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
fr2 = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._timestamp, "V") /
|
||||
sqrt(9.81 * (
|
||||
p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")) /
|
||||
p.geometry.wet_width(
|
||||
p.get_ts_key(self._timestamp, "Z"))
|
||||
)),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
fr = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
fr1, fr2
|
||||
)
|
||||
)
|
||||
|
||||
self.lines["froude"][0].set_ydata(fr)
|
||||
|
||||
if "wet_area" in self._y:
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach.profiles
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach1.profiles
|
||||
)
|
||||
)
|
||||
d2 = list(
|
||||
map(
|
||||
lambda p: p.geometry.wet_area(
|
||||
p.get_ts_key(self._timestamp, "Z")),
|
||||
reach2.profiles
|
||||
)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
self.lines["wet_area"][0].set_ydata(d)
|
||||
|
||||
def _customize_x_axes_time(self, ts, mode="time"):
|
||||
|
|
@ -631,6 +845,20 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
ts = self._parent._timestamps
|
||||
|
||||
if self._current_res_id == 2: # compare results
|
||||
reach1 = self.data[0].river.reach(self._reach)
|
||||
reach2 = self.data[1].river.reach(self._reach)
|
||||
profile1 = reach1.profile(self._profile)
|
||||
profile2 = reach2.profile(self._profile)
|
||||
|
||||
q1 = profile1.get_key("Q")
|
||||
z1 = profile1.get_key("Z")
|
||||
v1 = profile1.get_key("V")
|
||||
|
||||
q2 = profile2.get_key("Q")
|
||||
z2 = profile2.get_key("Z")
|
||||
v2 = profile2.get_key("V")
|
||||
|
||||
q = profile.get_key("Q")
|
||||
z = profile.get_key("Z")
|
||||
v = profile.get_key("V")
|
||||
|
|
@ -666,7 +894,7 @@ class CustomPlot(PamhyrPlot):
|
|||
)
|
||||
self.lines["water_elevation"] = line
|
||||
|
||||
if "bed_elevation" in self._y:
|
||||
if "bed_elevation" in self._y and self._current_res_id != 2:
|
||||
|
||||
self.fill = ax.fill_between(
|
||||
ts, ts_z_min, z,
|
||||
|
|
@ -695,9 +923,23 @@ class CustomPlot(PamhyrPlot):
|
|||
if "depth" in self._y:
|
||||
|
||||
ax = self._axes[unit["depth"]]
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.max_water_depth(z), z)
|
||||
)
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.max_water_depth(z), z)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(lambda z: profile1.geometry.max_water_depth(z), z1)
|
||||
)
|
||||
d2 = list(
|
||||
map(lambda z: profile2.geometry.max_water_depth(z), z2)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
line = ax.plot(
|
||||
ts, d,
|
||||
|
|
@ -708,9 +950,23 @@ class CustomPlot(PamhyrPlot):
|
|||
if "mean_depth" in self._y:
|
||||
|
||||
ax = self._axes[unit["mean_depth"]]
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.mean_water_depth(z), z)
|
||||
)
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.mean_water_depth(z), z)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(lambda z: profile1.geometry.mean_water_depth(z), z1)
|
||||
)
|
||||
d2 = list(
|
||||
map(lambda z: profile2.geometry.mean_water_depth(z), z2)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
line = ax.plot(
|
||||
ts, d,
|
||||
|
|
@ -721,14 +977,38 @@ class CustomPlot(PamhyrPlot):
|
|||
if "froude" in self._y:
|
||||
|
||||
ax = self._axes[unit["froude"]]
|
||||
d = list(
|
||||
map(lambda z, v:
|
||||
v /
|
||||
sqrt(9.81 * (
|
||||
profile.geometry.wet_area(z) /
|
||||
profile.geometry.wet_width(z))
|
||||
), z, v)
|
||||
)
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(lambda z, v:
|
||||
v /
|
||||
sqrt(9.81 * (
|
||||
profile.geometry.wet_area(z) /
|
||||
profile.geometry.wet_width(z))
|
||||
), z, v)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(lambda z, v:
|
||||
v /
|
||||
sqrt(9.81 * (
|
||||
profile.geometry.wet_area(z) /
|
||||
profile.geometry.wet_width(z))
|
||||
), z1, v1)
|
||||
)
|
||||
d2 = list(
|
||||
map(lambda z, v:
|
||||
v /
|
||||
sqrt(9.81 * (
|
||||
profile.geometry.wet_area(z) /
|
||||
profile.geometry.wet_width(z))
|
||||
), z2, v2)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
line = ax.plot(
|
||||
ts, d, color='black', linestyle='--', lw=1.,
|
||||
|
|
@ -738,9 +1018,23 @@ class CustomPlot(PamhyrPlot):
|
|||
if "wet_area" in self._y:
|
||||
|
||||
ax = self._axes[unit["wet_area"]]
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.wet_area(z), z)
|
||||
)
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.wet_area(z), z)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(lambda z: profile.geometry.wet_area(z), z1)
|
||||
)
|
||||
d2 = list(
|
||||
map(lambda z: profile.geometry.wet_area(z), z2)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
line = ax.plot(
|
||||
ts, d, color='blue', linestyle='--', lw=1.,
|
||||
|
|
@ -766,6 +1060,20 @@ class CustomPlot(PamhyrPlot):
|
|||
ts = list(results.get("timestamps"))
|
||||
ts.sort()
|
||||
|
||||
if self._current_res_id == 2: # compare results
|
||||
reach1 = self.data[0].river.reach(self._reach)
|
||||
reach2 = self.data[1].river.reach(self._reach)
|
||||
profile1 = reach1.profile(self._profile)
|
||||
profile2 = reach2.profile(self._profile)
|
||||
|
||||
q1 = profile1.get_key("Q")
|
||||
z1 = profile1.get_key("Z")
|
||||
v1 = profile1.get_key("V")
|
||||
|
||||
q2 = profile2.get_key("Q")
|
||||
z2 = profile2.get_key("Z")
|
||||
v2 = profile2.get_key("V")
|
||||
|
||||
q = profile.get_key("Q")
|
||||
z = profile.get_key("Z")
|
||||
v = profile.get_key("V")
|
||||
|
|
@ -785,7 +1093,7 @@ class CustomPlot(PamhyrPlot):
|
|||
if "water_elevation" in self._y:
|
||||
self.lines["water_elevation"][0].set_ydata(z)
|
||||
|
||||
if "bed_elevation" in self._y:
|
||||
if "bed_elevation" in self._y and self._current_res_id != 2:
|
||||
ax = self._axes[unit["bed_elevation"]]
|
||||
self.fill.remove()
|
||||
self.fill = ax.fill_between(
|
||||
|
|
@ -800,32 +1108,102 @@ class CustomPlot(PamhyrPlot):
|
|||
self.lines["velocity"][0].set_ydata(v)
|
||||
|
||||
if "depth" in self._y:
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.max_water_depth(z), z)
|
||||
)
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.max_water_depth(z), z)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(lambda z: profile1.geometry.max_water_depth(z), z1)
|
||||
)
|
||||
d2 = list(
|
||||
map(lambda z: profile2.geometry.max_water_depth(z), z2)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
self.lines["depth"][0].set_ydata(d)
|
||||
|
||||
if "mean_depth" in self._y:
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.mean_water_depth(z), z)
|
||||
)
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.mean_water_depth(z), z)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(lambda z: profile1.geometry.mean_water_depth(z), z1)
|
||||
)
|
||||
d2 = list(
|
||||
map(lambda z: profile2.geometry.mean_water_depth(z), z2)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
self.lines["mean_depth"][0].set_ydata(d)
|
||||
|
||||
if "froude" in self._y:
|
||||
d = list(
|
||||
map(lambda z, v:
|
||||
v /
|
||||
sqrt(9.81 * (
|
||||
profile.geometry.wet_area(z) /
|
||||
profile.geometry.wet_width(z))
|
||||
), z, v)
|
||||
)
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(lambda z, v:
|
||||
v /
|
||||
sqrt(9.81 * (
|
||||
profile.geometry.wet_area(z) /
|
||||
profile.geometry.wet_width(z))
|
||||
), z, v)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(lambda z, v:
|
||||
v /
|
||||
sqrt(9.81 * (
|
||||
profile.geometry.wet_area(z) /
|
||||
profile.geometry.wet_width(z))
|
||||
), z1, v1)
|
||||
)
|
||||
d2 = list(
|
||||
map(lambda z, v:
|
||||
v /
|
||||
sqrt(9.81 * (
|
||||
profile.geometry.wet_area(z) /
|
||||
profile.geometry.wet_width(z))
|
||||
), z2, v2)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
self.lines["froude"][0].set_ydata(d)
|
||||
|
||||
if "wet_area" in self._y:
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.wet_area(z), z)
|
||||
)
|
||||
if self._current_res_id != 2:
|
||||
d = list(
|
||||
map(lambda z: profile.geometry.wet_area(z), z)
|
||||
)
|
||||
else:
|
||||
d1 = list(
|
||||
map(lambda z: profile.geometry.wet_area(z), z1)
|
||||
)
|
||||
d2 = list(
|
||||
map(lambda z: profile.geometry.wet_area(z), z2)
|
||||
)
|
||||
d = list(
|
||||
map(
|
||||
lambda x, y: x - y,
|
||||
d1, d2
|
||||
)
|
||||
)
|
||||
|
||||
self.lines["wet_area"][0].set_ydata(d)
|
||||
|
||||
self.canvas.axes.relim(visible_only=True)
|
||||
|
|
@ -848,28 +1226,51 @@ class CustomPlot(PamhyrPlot):
|
|||
if self.data is None:
|
||||
return
|
||||
|
||||
self._y_axes = sorted(
|
||||
set(
|
||||
map(
|
||||
lambda y: unit[y],
|
||||
self._y
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
self.canvas.axes.set_xlabel(
|
||||
self._trad[self._x],
|
||||
color='black', fontsize=10
|
||||
)
|
||||
|
||||
self.canvas.axes.set_ylabel(
|
||||
self._trad[self._y_axes[0]],
|
||||
color='black', fontsize=10
|
||||
)
|
||||
|
||||
self._axes[self._y_axes[0]] = self.canvas.axes
|
||||
for axes in self._y_axes[1:]:
|
||||
if axes in self._axes:
|
||||
self._axes[axes].clear()
|
||||
continue
|
||||
|
||||
ax_new = self.canvas.axes.twinx()
|
||||
ax_new.set_ylabel(
|
||||
self._trad[axes],
|
||||
if self._current_res_id != 2:
|
||||
self.canvas.axes.set_ylabel(
|
||||
self._trad[self._y_axes[0]],
|
||||
color='black', fontsize=10
|
||||
)
|
||||
self._axes[axes] = ax_new
|
||||
else:
|
||||
self.canvas.axes.set_ylabel(
|
||||
"Δ " + self._trad[self._y_axes[0]],
|
||||
color='black', fontsize=10
|
||||
)
|
||||
|
||||
self._axes[self._y_axes[0]] = self.canvas.axes
|
||||
if len(self.lines) != 0:
|
||||
self.lines.clear()
|
||||
for axes in self._y_axes[1:]:
|
||||
print("axes: ", axes)
|
||||
if axes in self._axes.keys():
|
||||
for l in self._axes[axes].lines:
|
||||
l.remove()
|
||||
else:
|
||||
ax_new = self.canvas.axes.twinx()
|
||||
self._axes[axes] = ax_new
|
||||
if self._current_res_id != 2:
|
||||
self._axes[axes].set_ylabel(
|
||||
self._trad[axes],
|
||||
color='black', fontsize=10
|
||||
)
|
||||
else:
|
||||
self._axes[axes].set_ylabel(
|
||||
"Δ " + self._trad[axes],
|
||||
color='black', fontsize=10
|
||||
|
||||
if self._x == "rk":
|
||||
self._draw_rk()
|
||||
|
|
|
|||
Loading…
Reference in New Issue