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
add_variables drops non-dimension coordinates since #1078 #1084
Drafted with AI assistance. The repro was run on both commits below.
Version Checks
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 (b1d6a2e).
Issue Description
Since #1078, add_variables drops non-dimension coordinates of an xr.Coordinates. The new fast path _variables_on (linopy/model.py:1016) builds its grid with _coords_to_dict, which keeps only dimension coordinates. The coordinates are gone before any constraint or netcdf code runs. This undoes #1024, whose test still passes because both sides of the round trip lack the coordinate.
@FabianHofmann I can open a small fix PR: fall back to the old path in _variables_on when coords carries non-dimension coordinates, and add an assert "time" in x.coords to the #1024 test. OK?
Activity