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