Commit ac6e8a37 authored by Theophile Terraz's avatar Theophile Terraz
Browse files

debug Adis-TS files generation

No related merge requests found
Showing with 17 additions and 10 deletions
+17 -10
...@@ -410,10 +410,16 @@ class AdisTSwc(AdisTS): ...@@ -410,10 +410,16 @@ class AdisTSwc(AdisTS):
def _export_ICs_AdisTS_Spec(self, study, pol_ics_spec_data, def _export_ICs_AdisTS_Spec(self, study, pol_ics_spec_data,
f, qlog, name="0"): f, qlog, name="0"):
edges = study.river.enable_edges()
for ic_spec in pol_ics_spec_data: for ic_spec in pol_ics_spec_data:
id_reach = ic_spec.reach
reach = next((x for x in edges if x.id == id_reach), None)
if reach is None:
continue
f.write(" ".join((f"{ic_spec.name}", f.write(" ".join((f"{ic_spec.name}",
"=", "=",
f"{ic_spec.reach}", f"{study.river.get_edge_id(reach)+1}",
f"{ic_spec.start_rk}", f"{ic_spec.start_rk}",
f"{ic_spec.end_rk}", f"{ic_spec.end_rk}",
f"{ic_spec.concentration}", f"{ic_spec.concentration}",
...@@ -470,13 +476,14 @@ class AdisTSwc(AdisTS): ...@@ -470,13 +476,14 @@ class AdisTSwc(AdisTS):
id_edges = list(map(lambda x: x.id, edges)) id_edges = list(map(lambda x: x.id, edges))
id_reach = d90_spec.reach id_reach = d90_spec.reach
reach = next((x for x in edges if x.id == id_reach), None)
if id_reach not in id_edges: if reach is None:
return return
f.write(" ".join((f"{d90_spec.name}", f.write(" ".join((f"{d90_spec.name}",
"=", "=",
f"{id_reach}", f"{study.river.get_edge_id(reach)+1}",
f"{d90_spec.start_rk}", f"{d90_spec.start_rk}",
f"{d90_spec.end_rk}", f"{d90_spec.end_rk}",
f"{d90_spec.d90}\n"))) f"{d90_spec.d90}\n")))
...@@ -526,23 +533,22 @@ class AdisTSwc(AdisTS): ...@@ -526,23 +533,22 @@ class AdisTSwc(AdisTS):
edges = study.river.enable_edges() edges = study.river.enable_edges()
id_edges = list(map(lambda x: x.id, edges))
id_reach = dif_spec.reach id_reach = dif_spec.reach
reach = next((x for x in edges if x.id == id_reach), None)
if id_reach not in id_edges: if reach is None:
return return
if dif_spec.method != "generique": if dif_spec.method != "generique":
f.write(" ".join((f"{dif_spec.method}", f.write(" ".join((f"{dif_spec.method}",
"=", "=",
f"{id_reach}", f"{study.river.get_edge_id(reach)+1}",
f"{dif_spec.start_rk}", f"{dif_spec.start_rk}",
f"{dif_spec.end_rk}", f"{dif_spec.end_rk}",
f"{dif_spec.dif}\n"))) f"{dif_spec.dif}\n")))
else: else:
f.write(" ".join((f"{dif_spec.method}", f.write(" ".join((f"{dif_spec.method}",
f"=" f"{id_reach}", f"=" f"{study.river.get_edge_id(reach)+1}",
f"{dif_spec.start_rk}", f"{dif_spec.start_rk}",
f"{dif_spec.end_rk}", f"{dif_spec.end_rk}",
f"{dif_spec.dif}", f"{dif_spec.dif}",
...@@ -602,13 +608,14 @@ class AdisTSwc(AdisTS): ...@@ -602,13 +608,14 @@ class AdisTSwc(AdisTS):
id_edges = list(map(lambda x: x.id, edges)) id_edges = list(map(lambda x: x.id, edges))
id_reach = outputrk.reach id_reach = outputrk.reach
reach = next((x for x in edges if x.id == id_reach), None)
rk = outputrk.rk rk = outputrk.rk
title = outputrk.title title = outputrk.title
if id_reach not in id_edges: if reach is None:
return return
f.write(f"output = {id_reach} {rk} {title}\n") f.write(f"output = {study.river.get_edge_id(reach)+1} {rk} {title}\n")
@timer @timer
def read_bin(self, study, repertory, results, qlog=None, name="0"): def read_bin(self, study, repertory, results, qlog=None, name="0"):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment