mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Mage, Initial Cond: Fix INI files export.
This commit is contained in:
1 parent
e66b7f665a
commit
d9176c6d83
3 files changed
+39
-7
No files matched your search
+16
-6
@@ -92,6 +92,7 @@ class Mage(AbstractSolver):
|
||||
|
||||
return files
|
||||
|
||||
@timer
|
||||
def _export_BC(self, bound, repertory, qlog):
|
||||
files = []
|
||||
|
||||
@@ -166,7 +167,6 @@ class Mage(AbstractSolver):
|
||||
f.write(f"K{num} {bkp}{ekp}{coef_1}{coef_2}\n")
|
||||
id += 1
|
||||
|
||||
|
||||
return files
|
||||
|
||||
@timer
|
||||
@@ -180,22 +180,32 @@ class Mage(AbstractSolver):
|
||||
with open(os.path.join(repertory, "0.INI"), "w+") as f:
|
||||
files.append("0.INI")
|
||||
f.write("* This file is generate by PAMHYR, please don't modify\n")
|
||||
# TODO put real date...
|
||||
f.write(f"$ date en minutes : 0.00\n")
|
||||
f.write(f"* IB IS discharge elevation kp\n")
|
||||
|
||||
id = 1
|
||||
reachs = study.river.edges()
|
||||
for reach in reachs:
|
||||
cond = study.river.initial_conditions.get(reach)
|
||||
data = cond.data
|
||||
|
||||
id = f"{reach.id+1:>3}"
|
||||
id_sec = 1
|
||||
for data in cond.data:
|
||||
discharge = f"{data['flow']:>10.5f}"
|
||||
cote = f"{data['elevation']:>11.6f}"
|
||||
for d in data:
|
||||
IR = f"{id:>3}"
|
||||
IS = f"{id_sec:>3}"
|
||||
discharge = f"{d['flow']:>10.5f}"
|
||||
elevation = f"{d['elevation']:>11.6f}"
|
||||
kp = f"{d['kp']:>9.2f}"
|
||||
|
||||
f.write(f" {id} {id_sec:>3} {discharge}{cote}\n")
|
||||
f.write(f" {IR} {IS} {discharge}{elevation} {kp}\n")
|
||||
id_sec += 1
|
||||
|
||||
id += 1
|
||||
|
||||
return files
|
||||
|
||||
@timer
|
||||
def _export_REP(self, study, repertory, files, qlog):
|
||||
if qlog is not None:
|
||||
qlog.put("Export REP file")
|
||||
|
||||
Reference in new issue
Block a user