You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
v1: solve-time coordinate check rejects models with independent label sets on a shared dimension (breaks PyPSA) #986
I have confirmed this bug exists on the latest release of Linopy.
I have confirmed this bug exists on the current master branch of Linopy.
Issue Description
Since #955, Model.solve() runs _check_coord_consistency() under semantics="v1". It raises when two containers share a dimension name but their labels do not nest.
PyPSA uses one dimension name for all components (Generator-p, Store-e, Bus-nodal_balance, ...), each with its own disjoint labels. So every PyPSA model with more than one component type fails at solve time under v1. Running PyPSA master tests (test_lopf_storage, test_lopf_multiinvest, test_optimization_expressions, test_components_store) with LINOPY_SEMANTICS=v1 against linopy master gives 42 of 148 failed, all with this error.
These variables are never combined element-wise, so no ambiguous alignment happens. The model is valid.
ValueError: Coordinates for dimension 'name' are incompatible across the model: 'Store-e' carries labels not contained in the largest carrier 'Generator-p', so they are neither equal nor subsets of a shared index. Use Model.assign_coords to relabel the model, or align the containers with `.sel`.
Expected Behavior
The model solves, as under legacy semantics. Containers that share a dimension name without being combined should not need identical or nested labels. Alternatively, v1 should document how downstream packages like PyPSA should model independent label sets on a shared dimension name, before the check becomes a hard error.
Note
This issue was drafted with AI assistance.
Version Checks (indicate both or one)
masterbranch of Linopy.Issue Description
Since #955,
Model.solve()runs_check_coord_consistency()undersemantics="v1". It raises when two containers share a dimension name but their labels do not nest.PyPSA uses one dimension
namefor all components (Generator-p,Store-e,Bus-nodal_balance, ...), each with its own disjoint labels. So every PyPSA model with more than one component type fails at solve time under v1. Running PyPSA master tests (test_lopf_storage,test_lopf_multiinvest,test_optimization_expressions,test_components_store) withLINOPY_SEMANTICS=v1against linopy master gives 42 of 148 failed, all with this error.These variables are never combined element-wise, so no ambiguous alignment happens. The model is valid.
Reproducible Example
Expected Behavior
The model solves, as under legacy semantics. Containers that share a dimension name without being combined should not need identical or nested labels. Alternatively, v1 should document how downstream packages like PyPSA should model independent label sets on a shared dimension name, before the check becomes a hard error.
Installed Versions