From 7d2ef351281bbbbd77d2a58e74a48b0cf422c66c Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Mon, 5 Oct 2026 16:19:41 +0200 Subject: [PATCH] Results Rubar3: fix opening results window from the solver log window --- src/Solver/RubarBE.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Solver/RubarBE.py b/src/Solver/RubarBE.py index 4da1ad1f..82b01537 100644 --- a/src/Solver/RubarBE.py +++ b/src/Solver/RubarBE.py @@ -616,6 +616,7 @@ class Rubar3(CommandLineSolver): )).value if timestamp.count(':') == 3: timestamp = old_pamhyr_date_to_timestamp(timestamp) + timestamp = float(timestamp) ts.add(timestamp) # add initial condition @@ -636,8 +637,7 @@ class Rubar3(CommandLineSolver): while True: line = f.readline() if line == "": - results.set("timestamps", ts) - return + break timestamp = float(line) ts.add(timestamp) @@ -671,6 +671,24 @@ class Rubar3(CommandLineSolver): h, s, q, z = read_data_line(f) set_and_compute_limites(reach, ind, z+h, q, s) + # Tables and plots use timestamp rows and global profile columns. + timestamps = sorted(ts) + profiles = [] + for reach, _ in reachs: + offset = len(profiles) + profiles.extend(reach.profiles) + reach.set_global_index(range(offset, len(profiles))) + + results.set("timestamps", timestamps) + results.compute_timestamp_index() + results.set("table", { + key: np.array([ + [profile.get_ts_key(t, key) for profile in profiles] + for t in timestamps + ], dtype=float) + for key in ("Z", "Q", "V") + }) + @timer def write_bin(self, study, fname, results, qlog=None, name="0"): logger.info(f"write_bin: Start writing '{fname}' ...")