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
The following content was generated by AI (Claude Code) while reviewing #929, verified by @FabianHofmann.
read_netcdf rebuilds the variable, expression and constraint containers with sorted(...) over the names (linopy/io.py, read_netcdf), so a model comes back in alphabetical instead of insertion order. Labels are preserved, but matrices.A orders its columns by container iteration, so the matrix of a round-tripped model is a column permutation of the original. Same for the constraint rows. Independent of the semantics option and of frozen constraints.
Store the container order in the file (e.g. an attribute listing the names) and rebuild in that order, falling back to the sorted order for files without it.
Note
The following content was generated by AI (Claude Code) while reviewing #929, verified by @FabianHofmann.
read_netcdfrebuilds the variable, expression and constraint containers withsorted(...)over the names (linopy/io.py,read_netcdf), so a model comes back in alphabetical instead of insertion order. Labels are preserved, butmatrices.Aorders its columns by container iteration, so the matrix of a round-tripped model is a column permutation of the original. Same for the constraint rows. Independent of thesemanticsoption and of frozen constraints.Repro
Proposal
Store the container order in the file (e.g. an attribute listing the names) and rebuild in that order, falling back to the sorted order for files without it.