Ensemble: Results: PlotRKC: Fix table access.

scenario-dev-pa
Pierre-Antoine 2026-09-08 16:33:29 +02:00
parent a0886d900e
commit 03299db99a
2 changed files with 15 additions and 2 deletions

View File

@ -160,7 +160,8 @@ class PlotRKCEnsemble(PamhyrPlot):
table = result.get("table")[t]
ts = result.get_timestamp_id(self._current_timestamp)
water_z = table[ts, :]
gi_0, gi_1 = reach.global_index
water_z = table[ts, gi_0 : gi_1 + 1]
self.water = self.canvas.axes.plot(
rk, water_z,
@ -264,7 +265,8 @@ class PlotRKCEnsemble(PamhyrPlot):
table = result.get("table")["Z"]
ts = result.get_timestamp_id(self._current_timestamp)
water_z = table[ts, :]
gi_0, gi_1 = reach.global_index
water_z = table[ts, gi_0 : gi_1 + 1]
self.water[0].set_data(
rk, water_z

View File

@ -566,6 +566,17 @@ class SolverLogEnsWindow(SolverLogWindow):
results.set("table", table)
# Compute global index for reaches and profiles
gi = 0
for reach in results.river.reachs:
gi_start = gi
for profile in reach.profiles:
gi += 1
reach.set_global_index(range(gi_start, gi))
# Compute timestamps index table
ts = tables["timestamps"]
ts_index = {}
for i, t in enumerate(sorted(ts)):