Translate: Rename KP to RK (River Kilometric).

This commit is contained in:
Pierre-Antoine Rouby committed 2024-07-05 15:27:18 +02:00
1 parent b83494888b
commit 46dc527222
66 files changed
+668 -614

No files matched your search

+13 -13
View File
@@ -180,7 +180,7 @@ class Mage(CommandLineSolver):
c1 = f"{profile.code1:>6}"
c2 = f"{profile.code2:>6}"
t = f"{len(profile.points):>6}"
kp = f"{profile.kp:>12f}"[0:12]
rk = f"{profile.rk:>12f}"[0:12]
pname = profile.name
if profile.name == "":
# Generate name from profile id prefixed with
@@ -207,7 +207,7 @@ class Mage(CommandLineSolver):
)
# Profile header line
wfile.write(f"{num}{c1}{c2}{t} {kp} {pname} {sediment}\n")
wfile.write(f"{num}{c1}{c2}{t} {rk} {pname} {sediment}\n")
def _export_ST_point_line(self, wfile, files, point):
x = f"{point.x:<12.4f}"[0:12]
@@ -339,7 +339,7 @@ class Mage(CommandLineSolver):
f.write(f"* {lateral.edge.name} ({name}) {lateral.lctype}\n")
f.write(
f"${name} " +
f"{lateral.begin_kp:>10.4f} {lateral.end_kp:>10.4f}\n"
f"{lateral.begin_rk:>10.4f} {lateral.end_rk:>10.4f}\n"
)
header = lateral.header
f.write(f"*{header[0]:>9}|{header[1]:>10}\n")
@@ -371,17 +371,17 @@ class Mage(CommandLineSolver):
continue
num = f"{id:>3}"
bkp = f"{friction.begin_kp:>10.3f}"
ekp = f"{friction.end_kp:>10.3f}"
brk = f"{friction.begin_rk:>10.3f}"
erk = f"{friction.end_rk:>10.3f}"
# if friction.begin_kp != friction.end_kp:
# if friction.begin_rk != friction.end_rk:
# print("TODO")
strickler = friction.begin_strickler
coef_1 = f"{strickler.minor:>10.3f}"
coef_2 = f"{strickler.medium:>10.3f}"
f.write(f"K{num} {bkp}{ekp}{coef_1}{coef_2}\n")
f.write(f"K{num} {brk}{erk}{coef_1}{coef_2}\n")
id += 1
@@ -401,7 +401,7 @@ class Mage(CommandLineSolver):
# TODO put real date...
f.write(f"$ date en minutes : 0.00\n")
f.write(f"* IB IS discharge elevation kp\n")
f.write(f"* IB IS discharge elevation rk\n")
id = 1
for reach in reachs:
@@ -418,9 +418,9 @@ class Mage(CommandLineSolver):
IS = f"{id_sec}"
discharge = f"{d['discharge']:>10.5f}"
elevation = f"{d['elevation']:>11.6f}"
kp = f"{d['kp']:>9.2f}"
rk = f"{d['rk']:>9.2f}"
f.write(f"{IR} {IS} {discharge} {elevation} {kp}\n")
f.write(f"{IR} {IS} {discharge} {elevation} {rk}\n")
id_sec += 1
id += 1
@@ -495,12 +495,12 @@ class Mage(CommandLineSolver):
if not hs.enabled:
continue
if hs.input_kp is None:
if hs.input_rk is None:
continue
f.write(
'* ouvrage au pk ' +
f"{float(hs.input_kp):>12.1f}" + ' ' +
f"{float(hs.input_rk):>12.1f}" + ' ' +
hs.name + '\n'
)
@@ -527,7 +527,7 @@ class Mage(CommandLineSolver):
f.write(
f"{sin_dict[bhs._type]} " +
f"{reach_id} {float(hs.input_kp):>12.3f} " +
f"{reach_id} {float(hs.input_rk):>12.3f} " +
f"{param_str} {name}\n"
)
+13 -13
View File
@@ -265,10 +265,10 @@ class RubarBE(CommandLineSolver):
ind = 1
for profile in reach.profiles:
kp = profile.kp
rk = profile.rk
n_points = len(profile)
f.write(f"{ind:>4} {kp:>11.3f} {n_points:>4}\n")
f.write(f"{ind:>4} {rk:>11.3f} {n_points:>4}\n")
for point in profile.points:
label = point.name.lower()
@@ -307,8 +307,8 @@ class RubarBE(CommandLineSolver):
lm = len(reach) + 1
f.write(f"{lm:>13}\n")
for mails in [reach.inter_profiles_kp(),
reach.get_kp()]:
for mails in [reach.inter_profiles_rk(),
reach.get_rk()]:
ind = 0
for mail in mails:
f.write(f"{mail:15.3f}")
@@ -338,7 +338,7 @@ class RubarBE(CommandLineSolver):
lm = len(reach) + 1
f.write(f"{lm:>6}\n")
def get_stricklers_from_kp(kp):
def get_stricklers_from_rk(rk):
return next(
map(
lambda s: (
@@ -346,15 +346,15 @@ class RubarBE(CommandLineSolver):
else s.begin_strickler.minor
),
filter(
lambda f: kp in f,
lambda f: rk in f,
edge.frictions.lst
)
)
)
ind = 1
for mail in edge.reach.inter_profiles_kp():
coef = get_stricklers_from_kp(mail)
for mail in edge.reach.inter_profiles_rk():
coef = get_stricklers_from_rk(mail)
f.write(f"{ind:>6} {coef:>12.5f}")
@@ -382,7 +382,7 @@ class RubarBE(CommandLineSolver):
first = profiles[0]
last = profiles[-1]
if first.kp not in data or last.kp not in data:
if first.rk not in data or last.rk not in data:
logger.error(
"Study initial condition is not fully defined"
)
@@ -400,7 +400,7 @@ class RubarBE(CommandLineSolver):
prev_h, prev_s = f_h_s
for profile in it:
if profile.kp not in data:
if profile.rk not in data:
ind += 1
continue
@@ -424,7 +424,7 @@ class RubarBE(CommandLineSolver):
data = {}
for d in ics.data:
data[d['kp']] = (
data[d['rk']] = (
d['elevation'],
d['discharge'],
)
@@ -432,8 +432,8 @@ class RubarBE(CommandLineSolver):
return data
def _export_tps_profile_height_speed(self, profile, data):
z = data[profile.kp][0]
q = data[profile.kp][1]
z = data[profile.rk][0]
q = data[profile.rk][1]
height = z - profile.z_min()
speed = profile.speed(q, z)