Skip to content

Meta: predictable arithmetic — coordinate alignment and NaN handling #714

Description

@FBumann

Tracking issue for the known problems with linopy's arithmetic — coordinate alignment and NaN handling — and the v1 convention that fixes them.

linopy aligns coordinates with size-based heuristics. When operands don't line up it guesses, and the guesses are sometimes silently wrong — no exception, the solver returns Optimal, the objective looks plausible. PyPSA/PyPSA#1677 shipped a workaround for one such case (a capacity-expansion result 47% too cheap).

Bugs — silent wrong answers

Opinionated behaviour — silent, debatable choices

Already fixed in v0.7.0

Out of scope

Predictability issues, but not arithmetic-alignment bugs:

#703 (xarray method coverage) consumes the convention rather than constraining it.

The fix

A strict v1 arithmetic convention behind linopy.options["arithmetic_convention"] — align by label, raise on a mismatch, NaN means "absent term". It ships opt-in, becomes the default, and legacy is removed at linopy 1.0. One PR carries the design goals, the spec, tests and code; docs follow. Implementation: #591. Milestone: Predictable Arithmetics.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions