mirror of https://gitlab.com/pamhyr/pamhyr2
Results: CustomPlot: Continue to switch to np table.
parent
3e094af325
commit
0a1760cee6
|
|
@ -91,7 +91,6 @@ class CustomPlot(PamhyrPlot):
|
|||
self.lines = {}
|
||||
|
||||
def draw_bottom_with_bedload(self, reach):
|
||||
|
||||
rk = reach.geometry.get_rk()
|
||||
z = list(
|
||||
map(
|
||||
|
|
@ -341,8 +340,7 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
line1 = ax.plot(
|
||||
rk, vmax, lw=1.,
|
||||
color='g',
|
||||
linestyle='dotted',
|
||||
color='g', linestyle='dotted',
|
||||
)
|
||||
self.lines["velocity_envelop"] = line1
|
||||
vmin = [min(v) for v in velocities]
|
||||
|
|
@ -397,7 +395,7 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
d = list(map(
|
||||
lambda p1, p2: p1 - p2, map(
|
||||
lambda p: max(p.get_key("Z")),
|
||||
lambda p: np.max(table["Z"][:, p.global_index]),
|
||||
reach.profiles
|
||||
), z_min)
|
||||
)
|
||||
|
|
@ -574,6 +572,9 @@ class CustomPlot(PamhyrPlot):
|
|||
reach1 = self.data[0].river.reach(self._current_reach)
|
||||
reach2 = self.data[1].river.reach(self._current_reach)
|
||||
|
||||
table = results.get("table")
|
||||
id_ts = results.get_timestamp_id(self._current_timestamp)
|
||||
|
||||
rk = reach.geometry.get_rk()
|
||||
z_min = reach.geometry.get_z_min()
|
||||
if reach.has_bedload():
|
||||
|
|
@ -583,19 +584,19 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
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["Z"][id_ts, p.global_index],
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -642,7 +643,8 @@ class CustomPlot(PamhyrPlot):
|
|||
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
|
||||
)
|
||||
)
|
||||
|
|
@ -650,14 +652,16 @@ 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
|
||||
)
|
||||
)
|
||||
|
|
@ -675,7 +679,8 @@ class CustomPlot(PamhyrPlot):
|
|||
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
|
||||
)
|
||||
)
|
||||
|
|
@ -683,14 +688,16 @@ 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
|
||||
)
|
||||
)
|
||||
|
|
@ -707,41 +714,50 @@ class CustomPlot(PamhyrPlot):
|
|||
if self._current_res_id < 2:
|
||||
fr = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._current_timestamp, "V") /
|
||||
lambda p: (
|
||||
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
|
||||
)
|
||||
)
|
||||
else:
|
||||
fr1 = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._current_timestamp, "V") /
|
||||
lambda p: (
|
||||
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
|
||||
)
|
||||
)
|
||||
fr2 = list(
|
||||
map(
|
||||
lambda p:
|
||||
p.get_ts_key(self._current_timestamp, "V") /
|
||||
lambda p: (
|
||||
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
|
||||
)
|
||||
)
|
||||
|
|
@ -759,7 +775,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
|
||||
)
|
||||
)
|
||||
|
|
@ -767,14 +784,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
|
||||
)
|
||||
)
|
||||
|
|
@ -845,6 +864,7 @@ class CustomPlot(PamhyrPlot):
|
|||
shift += 60
|
||||
|
||||
ts = self._parent._timestamps
|
||||
table = results.get("table")
|
||||
|
||||
if self._current_res_id == 2: # compare results
|
||||
reach1 = self.data[0].river.reach(self._current_reach)
|
||||
|
|
@ -852,17 +872,18 @@ class CustomPlot(PamhyrPlot):
|
|||
profile1 = reach1.profile(self._current_profile_id)
|
||||
profile2 = reach2.profile(self._current_profile_id)
|
||||
|
||||
q1 = profile1.get_key("Q")
|
||||
z1 = profile1.get_key("Z")
|
||||
v1 = profile1.get_key("V")
|
||||
q1 = table["Q"][:, profile1.global_index]
|
||||
z1 = table["Z"][:, profile1.global_index]
|
||||
v1 = table["V"][:, profile1.global_index]
|
||||
|
||||
q2 = profile2.get_key("Q")
|
||||
z2 = profile2.get_key("Z")
|
||||
v2 = profile2.get_key("V")
|
||||
q2 = table["Q"][:, profile2.global_index]
|
||||
z2 = table["Z"][:, profile2.global_index]
|
||||
v2 = table["V"][:, profile2.global_index]
|
||||
|
||||
q = table["Q"][:, profile.global_index]
|
||||
z = table["Z"][:, profile.global_index]
|
||||
v = table["V"][:, profile.global_index]
|
||||
|
||||
q = profile.get_key("Q")
|
||||
z = profile.get_key("Z")
|
||||
v = profile.get_key("V")
|
||||
z_min = profile.geometry.z_min()
|
||||
if self._current_res_id < 2:
|
||||
if reach.has_bedload():
|
||||
|
|
@ -1070,30 +1091,32 @@ class CustomPlot(PamhyrPlot):
|
|||
self.update_legend()
|
||||
|
||||
def _redraw_time(self):
|
||||
|
||||
results = self.data[self._current_res_id]
|
||||
reach = results.river.reach(self._current_reach)
|
||||
profile = reach.profile(self._current_profile_id)
|
||||
ts = list(results.get("timestamps"))
|
||||
ts.sort()
|
||||
|
||||
table = results.get("table")
|
||||
|
||||
if self._current_res_id == 2: # compare results
|
||||
reach1 = self.data[0].river.reach(self._current_reach)
|
||||
reach2 = self.data[1].river.reach(self._current_reach)
|
||||
profile1 = reach1.profile(self._current_profile_id)
|
||||
profile2 = reach2.profile(self._current_profile_id)
|
||||
|
||||
q1 = profile1.get_key("Q")
|
||||
z1 = profile1.get_key("Z")
|
||||
v1 = profile1.get_key("V")
|
||||
q1 = table["Q"][:, profile1.global_index]
|
||||
z1 = table["Z"][:, profile1.global_index]
|
||||
v1 = table["V"][:, profile1.global_index]
|
||||
|
||||
q2 = profile2.get_key("Q")
|
||||
z2 = profile2.get_key("Z")
|
||||
v2 = profile2.get_key("V")
|
||||
q2 = table["Q"][:, profile2.global_index]
|
||||
z2 = table["Z"][:, profile2.global_index]
|
||||
v2 = table["V"][:, profile2.global_index]
|
||||
|
||||
q = table["Q"][:, profile.global_index]
|
||||
z = table["Z"][:, profile.global_index]
|
||||
v = table["V"][:, profile.global_index]
|
||||
|
||||
q = profile.get_key("Q")
|
||||
z = profile.get_key("Z")
|
||||
v = profile.get_key("V")
|
||||
if self._current_res_id < 2:
|
||||
if reach.has_bedload():
|
||||
ts_z_min = self.get_ts_zmin(
|
||||
|
|
|
|||
Loading…
Reference in New Issue