Results Rubar3: fix opening results window from the solver log window

This commit is contained in:
Dylan Jeannin committed 2026-10-05 16:19:41 +02:00
1 parent 40b48a2080
commit 7d2ef35128
1 file changed
+20 -2
+20 -2
View File
@@ -616,6 +616,7 @@ class Rubar3(CommandLineSolver):
)).value )).value
if timestamp.count(':') == 3: if timestamp.count(':') == 3:
timestamp = old_pamhyr_date_to_timestamp(timestamp) timestamp = old_pamhyr_date_to_timestamp(timestamp)
timestamp = float(timestamp)
ts.add(timestamp) ts.add(timestamp)
# add initial condition # add initial condition
@@ -636,8 +637,7 @@ class Rubar3(CommandLineSolver):
while True: while True:
line = f.readline() line = f.readline()
if line == "": if line == "":
results.set("timestamps", ts) break
return
timestamp = float(line) timestamp = float(line)
ts.add(timestamp) ts.add(timestamp)
@@ -671,6 +671,24 @@ class Rubar3(CommandLineSolver):
h, s, q, z = read_data_line(f) h, s, q, z = read_data_line(f)
set_and_compute_limites(reach, ind, z+h, q, s) 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 @timer
def write_bin(self, study, fname, results, qlog=None, name="0"): def write_bin(self, study, fname, results, qlog=None, name="0"):
logger.info(f"write_bin: Start writing '{fname}' ...") logger.info(f"write_bin: Start writing '{fname}' ...")