mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
No commits in common. "a61d130baa12a1041d15b4634e1645e3108b316e" and "3e094af325e197daf0837262659fd9b9a08b927f" have entirely different histories.
a61d130baa
...
3e094af325
|
|
@ -1107,7 +1107,7 @@ class Mage8(Mage):
|
|||
|
||||
# Profile ID offset
|
||||
reach_offset[r] = i1
|
||||
profile_len.append(i2 - i1 + 1)
|
||||
profile_len.append(i2-i1+1)
|
||||
|
||||
logger.debug(f"read_bin: iprofiles = {len(iprofiles)}")
|
||||
|
||||
|
|
@ -1161,7 +1161,7 @@ class Mage8(Mage):
|
|||
ri = i - reach_offset[reach]
|
||||
|
||||
# Set data for profile RI
|
||||
# reach.set(ri, timestamp, key, d)
|
||||
reach.set(ri, timestamp, key, d)
|
||||
if key == "Z":
|
||||
profile = reach.profile(ri)
|
||||
limits = profile.geometry.get_water_limits(d)
|
||||
|
|
@ -1201,7 +1201,7 @@ class Mage8(Mage):
|
|||
table["Q"][ti, p.global_index],
|
||||
table["Z"][ti, p.global_index],
|
||||
)
|
||||
# r.set(pi, t, "V", v)
|
||||
r.set(pi, t, "V", v)
|
||||
velocity_arr[ti, j] = v
|
||||
j += 1
|
||||
|
||||
|
|
@ -1210,9 +1210,9 @@ class Mage8(Mage):
|
|||
|
||||
logger.info(f"read_bin: ... end with {len(ts)} timestamp read")
|
||||
|
||||
# results.bufferize("Z")
|
||||
# results.bufferize("Q")
|
||||
# results.bufferize("V")
|
||||
results.bufferize("Z")
|
||||
results.bufferize("Q")
|
||||
results.bufferize("V")
|
||||
logger.info(f"reading time: '{time.time() - start}'")
|
||||
|
||||
@timer
|
||||
|
|
@ -1282,8 +1282,8 @@ class Mage8(Mage):
|
|||
reachs.append(r)
|
||||
|
||||
# ID of first and last reach profiles
|
||||
i1 = data[2 * i] - 1
|
||||
i2 = data[2 * i + 1] - 1
|
||||
i1 = data[2*i] - 1
|
||||
i2 = data[2*i+1] - 1
|
||||
|
||||
# Add profile id correspondance to reach
|
||||
key = (i1, i2)
|
||||
|
|
@ -1394,26 +1394,26 @@ class Mage8(Mage):
|
|||
r.profiles
|
||||
))
|
||||
z_br = list(map(
|
||||
lambda z, sl: reduce(
|
||||
lambda z, h: z - h[0],
|
||||
sl, z
|
||||
),
|
||||
z_min, # Original geometry
|
||||
sls # Original sediment layers
|
||||
))
|
||||
lambda z, sl: reduce(
|
||||
lambda z, h: z - h[0],
|
||||
sl, z
|
||||
),
|
||||
z_min, # Original geometry
|
||||
sls # Original sediment layers
|
||||
))
|
||||
for t in ts_list:
|
||||
sls = list(map(
|
||||
lambda p: p.get_ts_key(t, "sl")[0],
|
||||
r.profiles
|
||||
))
|
||||
))
|
||||
zfd = list(map(
|
||||
lambda z, sl: reduce(
|
||||
lambda z, h: z + h[0],
|
||||
sl, z
|
||||
),
|
||||
z_br, # bedrock
|
||||
sls # Original sediment layers
|
||||
))
|
||||
lambda z, sl: reduce(
|
||||
lambda z, h: z + h[0],
|
||||
sl, z
|
||||
),
|
||||
z_br, # bedrock
|
||||
sls # Original sediment layers
|
||||
))
|
||||
for i, p in enumerate(r.profiles):
|
||||
r.set(i, t, "zfd", zfd[i])
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ class CustomPlot(PamhyrPlot):
|
|||
self.lines = {}
|
||||
|
||||
def draw_bottom_with_bedload(self, reach):
|
||||
|
||||
rk = reach.geometry.get_rk()
|
||||
z = list(
|
||||
map(
|
||||
|
|
@ -340,7 +341,8 @@ 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]
|
||||
|
|
@ -395,7 +397,7 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
d = list(map(
|
||||
lambda p1, p2: p1 - p2, map(
|
||||
lambda p: np.max(table["Z"][:, p.global_index]),
|
||||
lambda p: max(p.get_key("Z")),
|
||||
reach.profiles
|
||||
), z_min)
|
||||
)
|
||||
|
|
@ -572,9 +574,6 @@ 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():
|
||||
|
|
@ -584,19 +583,19 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
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["Z"][id_ts, p.global_index],
|
||||
lambda p: p.get_ts_key(self._current_timestamp, "V"),
|
||||
reach.profiles
|
||||
)
|
||||
)
|
||||
|
|
@ -643,8 +642,7 @@ class CustomPlot(PamhyrPlot):
|
|||
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
|
||||
)
|
||||
)
|
||||
|
|
@ -652,16 +650,14 @@ 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
|
||||
)
|
||||
)
|
||||
|
|
@ -679,8 +675,7 @@ class CustomPlot(PamhyrPlot):
|
|||
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
|
||||
)
|
||||
)
|
||||
|
|
@ -688,16 +683,14 @@ 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
|
||||
)
|
||||
)
|
||||
|
|
@ -714,50 +707,41 @@ class CustomPlot(PamhyrPlot):
|
|||
if self._current_res_id < 2:
|
||||
fr = list(
|
||||
map(
|
||||
lambda p: (
|
||||
table["V"][id_ts, p.global_index] /
|
||||
lambda p:
|
||||
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
|
||||
)
|
||||
)
|
||||
else:
|
||||
fr1 = list(
|
||||
map(
|
||||
lambda p: (
|
||||
table["V"][id_ts, p.global_index] /
|
||||
lambda p:
|
||||
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] /
|
||||
lambda p:
|
||||
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
|
||||
)
|
||||
)
|
||||
|
|
@ -775,8 +759,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
|
||||
)
|
||||
)
|
||||
|
|
@ -784,16 +767,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
|
||||
)
|
||||
)
|
||||
|
|
@ -864,7 +845,6 @@ 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)
|
||||
|
|
@ -872,18 +852,17 @@ class CustomPlot(PamhyrPlot):
|
|||
profile1 = reach1.profile(self._current_profile_id)
|
||||
profile2 = reach2.profile(self._current_profile_id)
|
||||
|
||||
q1 = table["Q"][:, profile1.global_index]
|
||||
z1 = table["Z"][:, profile1.global_index]
|
||||
v1 = table["V"][:, profile1.global_index]
|
||||
q1 = profile1.get_key("Q")
|
||||
z1 = profile1.get_key("Z")
|
||||
v1 = profile1.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]
|
||||
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")
|
||||
z_min = profile.geometry.z_min()
|
||||
if self._current_res_id < 2:
|
||||
if reach.has_bedload():
|
||||
|
|
@ -1091,32 +1070,30 @@ 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 = table["Q"][:, profile1.global_index]
|
||||
z1 = table["Z"][:, profile1.global_index]
|
||||
v1 = table["V"][:, profile1.global_index]
|
||||
q1 = profile1.get_key("Q")
|
||||
z1 = profile1.get_key("Z")
|
||||
v1 = profile1.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]
|
||||
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")
|
||||
if self._current_res_id < 2:
|
||||
if reach.has_bedload():
|
||||
ts_z_min = self.get_ts_zmin(
|
||||
|
|
|
|||
Loading…
Reference in New Issue