Commit 792bb4d
fix: normalize clustered solution dim order to (cluster, time) (#704)
linopy <0.8 stores the extra-timestep charge_state variable as
(time, cluster), because its 'time' coordinate (length n+1) conflicts
with the model's 'time' (length n), and 0.7 reorders the conflicting
dim to the front. Every other variable is (cluster, time). linopy >=0.8
makes coords the source of truth and is already consistent.
flixopt cannot control this from the bounds/coords it passes (0.7
reorders internally), so normalize in the solution property: transpose
'cluster' before 'time'. This is a no-op on linopy >=0.8 and for
non-clustered systems, and only touches the cluster/time axis ordering
(other dims and scalars are preserved via the ellipsis).
Also update the clustering test to access charge_state by label and
assert the now-deterministic (cluster, time) order. Unblocks the
linopy 0.8 bump in #701.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent b6d66d8 commit 792bb4d
2 files changed
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| 338 | + | |
| 339 | + | |
338 | 340 | | |
339 | 341 | | |
340 | 342 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
340 | | - | |
341 | 339 | | |
342 | | - | |
343 | | - | |
344 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
345 | 343 | | |
346 | 344 | | |
347 | 345 | | |
| |||
0 commit comments