Solver: Mage: Comment setter Z, Q and V into profile and bufferize and fix indent.

opt-result
Pierre-Antoine 2026-07-02 11:00:59 +02:00
parent 0a1760cee6
commit a61d130baa
1 changed files with 23 additions and 23 deletions

View File

@ -1107,7 +1107,7 @@ class Mage8(Mage):
# Profile ID offset # Profile ID offset
reach_offset[r] = i1 reach_offset[r] = i1
profile_len.append(i2-i1+1) profile_len.append(i2 - i1 + 1)
logger.debug(f"read_bin: iprofiles = {len(iprofiles)}") logger.debug(f"read_bin: iprofiles = {len(iprofiles)}")
@ -1161,7 +1161,7 @@ class Mage8(Mage):
ri = i - reach_offset[reach] ri = i - reach_offset[reach]
# Set data for profile RI # Set data for profile RI
reach.set(ri, timestamp, key, d) # reach.set(ri, timestamp, key, d)
if key == "Z": if key == "Z":
profile = reach.profile(ri) profile = reach.profile(ri)
limits = profile.geometry.get_water_limits(d) limits = profile.geometry.get_water_limits(d)
@ -1201,7 +1201,7 @@ class Mage8(Mage):
table["Q"][ti, p.global_index], table["Q"][ti, p.global_index],
table["Z"][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 velocity_arr[ti, j] = v
j += 1 j += 1
@ -1210,9 +1210,9 @@ class Mage8(Mage):
logger.info(f"read_bin: ... end with {len(ts)} timestamp read") logger.info(f"read_bin: ... end with {len(ts)} timestamp read")
results.bufferize("Z") # results.bufferize("Z")
results.bufferize("Q") # results.bufferize("Q")
results.bufferize("V") # results.bufferize("V")
logger.info(f"reading time: '{time.time() - start}'") logger.info(f"reading time: '{time.time() - start}'")
@timer @timer
@ -1282,8 +1282,8 @@ class Mage8(Mage):
reachs.append(r) reachs.append(r)
# ID of first and last reach profiles # ID of first and last reach profiles
i1 = data[2*i] - 1 i1 = data[2 * i] - 1
i2 = data[2*i+1] - 1 i2 = data[2 * i + 1] - 1
# Add profile id correspondance to reach # Add profile id correspondance to reach
key = (i1, i2) key = (i1, i2)
@ -1394,26 +1394,26 @@ class Mage8(Mage):
r.profiles r.profiles
)) ))
z_br = list(map( z_br = list(map(
lambda z, sl: reduce( lambda z, sl: reduce(
lambda z, h: z - h[0], lambda z, h: z - h[0],
sl, z sl, z
), ),
z_min, # Original geometry z_min, # Original geometry
sls # Original sediment layers sls # Original sediment layers
)) ))
for t in ts_list: for t in ts_list:
sls = list(map( sls = list(map(
lambda p: p.get_ts_key(t, "sl")[0], lambda p: p.get_ts_key(t, "sl")[0],
r.profiles r.profiles
)) ))
zfd = list(map( zfd = list(map(
lambda z, sl: reduce( lambda z, sl: reduce(
lambda z, h: z + h[0], lambda z, h: z + h[0],
sl, z sl, z
), ),
z_br, # bedrock z_br, # bedrock
sls # Original sediment layers sls # Original sediment layers
)) ))
for i, p in enumerate(r.profiles): for i, p in enumerate(r.profiles):
r.set(i, t, "zfd", zfd[i]) r.set(i, t, "zfd", zfd[i])