Skip to content

Support xarray-binfile 0.4 (draft, on 0.4.0rc0) - #154

Draft
fschuch wants to merge 2 commits into
mainfrom
deps/xarray-binfile-0.4
Draft

fschuch wants to merge 2 commits into
mainfrom
deps/xarray-binfile-0.4

Conversation

@fschuch

@fschuch fschuch commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Draft: this tests xarray-binfile 0.4.0rc0 downstream. Before merging, change the pin to >=0.4.0,<0.5.0 once v0.4.0 is out.

Why

On main with xarray-binfile 0.4.0rc0, three TestStaticPlanes tests fail; on 0.3.2 they all pass:

LayoutMismatchError: ... '1:StaticFiles': The file 'byphi11.bin' would be read by
0:StaticFiles, listed before, so it would not read back as written.

0.4 makes PatternConventions.writer refuse a file that an earlier member would read on open() (xarray-binfile #85/#97, listed under Breaking changes in the rc notes). The inflow planes are three StaticFiles, one per dropped dimension, all sharing the {name}.bin pattern. They were wrapped in a PatternConventions, so the (y, z) plane claimed every name and the (x, z) plane byphi1 was refused.

The planes are written, never opened, so read-back order doesn't apply to them.

Change

  • pyproject.toml: xarray-binfile>=0.4.0rc0,<0.5.0.
  • Xcompact3dConvention.writer: the planes fallback tries each plane layout on its own and keeps the first that accepts the array. Their dims differ, so at most one does. If none accepts, the original field error is raised, as before.
  • New test: a line (one dim) fits no plane, raises LayoutMismatchError, and writes nothing. This covers the "no plane accepts" path.

Commits

  1. bb212f9: the pin. The three tests fail.
  2. 8bf46d4: the fix and the new test.

Verification

hatch run qa: 400 passed. In binfile.py the changed lines are covered; the two lines still uncovered (92, 447) are not touched here.

🤖 Generated with Claude Code

fschuch and others added 2 commits December 4, 2026 09:29
Fails three TestStaticPlanes tests: the composite writer in 0.4 refuses
a file that an earlier member would read back, and the write-only planes
share one pattern across three layouts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
xarray-binfile 0.4's composite writer refuses a file that an earlier
member would read back. The planes share one pattern but are written,
never opened, so try each plane layout on its own and keep the first
that accepts the array. Cover the case where none does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

No deployments
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