Commit 371a9c6
fix: normalize clustered solution dim order to (cluster, time)
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 371a9c6
2 files changed
Lines changed: 9 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
338 | 343 | | |
339 | 344 | | |
340 | 345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
340 | | - | |
| 339 | + | |
341 | 340 | | |
342 | | - | |
343 | | - | |
344 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
345 | 344 | | |
346 | 345 | | |
347 | 346 | | |
| |||
0 commit comments