Skip to content

docs(v1): cover the scalar-leftover-coord aux conflict (isel drop=True)#858

Merged
FBumann merged 1 commit into
feat/arithmetic-conventionfrom
docs/scalar-leftover-coord-aux-conflict
Jul 20, 2026
Merged

docs(v1): cover the scalar-leftover-coord aux conflict (isel drop=True)#858
FBumann merged 1 commit into
feat/arithmetic-conventionfrom
docs/scalar-leftover-coord-aux-conflict

Conversation

@FBumann

@FBumann FBumann commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Documents a v1 aux-coord conflict that's easy to hit and easy to miss. Part of the #717 migration-doc pass.

Same v1 rule as #791 (x[0] + x[1] / summing scalar selections), closed COMPLETED as intended (legacy warns about it). This PR documents the comparison form and the drop=True fix.

Note

The following was generated by AI.

The case. Positional indexing leaves a scalar coordinate behind: x.isel(time=0) drops time as a dimension but keeps it as a scalar coord (the first label). So a cyclic/boundary constraint — very common in storage/energy models —

x.isel(time=0) == x.isel(time=-1)

hits §11's auxiliary-coordinate conflict under v1 (time = first vs last) and raises, where legacy silently dropped it. Verified on the branch:

v1:     ValueError: Auxiliary coordinate 'time' has conflicting values across operands: left=0, right=3
legacy: builds silently
fix:    x.isel(time=0, drop=True) == x.isel(time=-1, drop=True)   # builds under v1

Why a doc change. The existing "Conflicting auxiliary coordinates" row technically covered it (the raise even says "Auxiliary coordinate"), but it listed only .drop_vars / .assign_coords and didn't name the scalar-leftover cause — so a user comparing two .isel endpoints wouldn't connect their error to that row, nor reach for the natural fix (drop=True at the indexing site).

  • doc/migrating-to-v1.rst — broadened the aux-coord row (situation names the scalar-leftover case; fix adds .isel/.sel(..., drop=True))
  • arithmetics-design/convention.md §11 — same note

Independent of #855/#856 (different regions of both files); should merge cleanly alongside them.

Positional indexing leaves a scalar coordinate behind: `x.isel(time=0)` drops
`time` as a dimension but keeps it as a scalar coord (the first label). So a
cyclic/boundary constraint like `x.isel(time=0) == x.isel(time=-1)` — extremely
common in storage/energy models — hits §11's aux-coord conflict under v1
(`time` = first vs last) and raises, where legacy silently dropped it.

The aux-coord row already covered this in principle, but listed only
`.drop_vars` / `.assign_coords` as fixes and didn't name the scalar-leftover
cause. Broaden the migration-guide row and add the natural fix — drop the coord
at the indexing site with `.isel(..., drop=True)` / `.sel(..., drop=True)` — and
add the same note to convention.md §11.

Verified on the branch: `x.isel(time=0) == x.isel(time=-1)` raises
"Auxiliary coordinate 'time' has conflicting values ... left=0, right=3" under
v1; `drop=True` on both sides builds cleanly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@FBumann
FBumann merged commit 1362134 into feat/arithmetic-convention Jul 20, 2026
1 of 2 checks passed
@FBumann
FBumann deleted the docs/scalar-leftover-coord-aux-conflict branch July 20, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant