From ad5cc831a3382911e86e0c07d35f00cce72f85f8 Mon Sep 17 00:00:00 2001 From: Theophile Terraz Date: Thu, 26 Mar 2026 10:51:21 +0100 Subject: [PATCH] debug bed elevation comparison --- src/Solver/Mage.py | 5 +++-- src/Solver/RubarBE.py | 7 ++++++- src/View/Results/CustomPlot/Plot.py | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Solver/Mage.py b/src/Solver/Mage.py index 24581996..6dfa5e1b 100644 --- a/src/Solver/Mage.py +++ b/src/Solver/Mage.py @@ -1027,7 +1027,8 @@ class Mage8(Mage): # Z and Y (4th line) newline() - _ = read_float(3*nb_profile) + tmp = read_float(3*nb_profile) + zfd = tmp[::3] endline() # Data @@ -1242,7 +1243,7 @@ class Mage8(Mage): i_pts = 0 i_data = 0 - # Loop on cross section + # Loop on cross sections for i in range(n): sec_sl = [] reach = ip_to_r(i) diff --git a/src/Solver/RubarBE.py b/src/Solver/RubarBE.py index c92f2169..b1850782 100644 --- a/src/Solver/RubarBE.py +++ b/src/Solver/RubarBE.py @@ -590,6 +590,8 @@ class Rubar3(CommandLineSolver): # Add results reach to reach list res_reach = results.river.add(i) reachs.append((res_reach, len(reach) + 1)) + results.set("nb_reach", f"{len(reachs)}") + results.set("nb_profile", f"{sum([r[1] - 1 for r in reachs])}") def read_data_line(f): line = f.readline().split() @@ -763,13 +765,16 @@ class Rubar3(CommandLineSolver): logger.info(f"write_bin: ... end with {len(ts_list)} timestamps") @timer - def results(self, study, repertory, qlog=None, name="0"): + def results(self, study, repertory, qlog=None, name=None): results = Results( study=study, solver=self, repertory=repertory, name=name, ) + if name is None: + name = study.name.replace(" ", "_") + results_file = f"profil.{name}" fname = os.path.join(repertory, results_file) diff --git a/src/View/Results/CustomPlot/Plot.py b/src/View/Results/CustomPlot/Plot.py index bcce3e66..c20b8182 100644 --- a/src/View/Results/CustomPlot/Plot.py +++ b/src/View/Results/CustomPlot/Plot.py @@ -230,7 +230,7 @@ class CustomPlot(PamhyrPlot): dz = list( map( lambda x, y: x - y, - z_min2, z_min2 + z_min1, z_min2 ) ) line = ax.plot( @@ -654,7 +654,7 @@ class CustomPlot(PamhyrPlot): dz = list( map( lambda x, y: x - y, - z_min2, z_min2 + z_min1, z_min2 ) ) self.lines["bed_elevation"][0].set_ydata(dz)