Track sectionate 0.4.0rc2: drop the removed layer/interface kwargs - #31
Merged
Conversation
sectionate 0.4.0rc2 removes the `layer` and `interface` keyword arguments from `convergent_transport` (hdrake/sectionate#7, "Take the vertical coordinates from the data and the grid, not the caller"). The layer coordinate is a dimension of `utr`/`vtr`, so it already rides along into the section; the interface coordinate cannot, but the grid knows it -- whichever axis registers the layer dimension at its "center" position names the interface. Neither needs a caller to name it, so both parameters are gone and passing either now raises TypeError. regionate's library code never passed them. Only the real-grid tests and the example notebooks did, so this bumps the floor and updates those call sites: - pyproject.toml: `sectionate >= 0.4.0rc1` -> `>= 0.4.0rc2`. A pre-release floor lets pip install pre-releases of that package, so a bare `pip install -e .` with no `--pre` resolves sectionate-0.4.0rc2 (verified by dry run). - regionate/tests/test_real_grids.py: 3 call sites lose `layer=`/`interface=`. Two passed `layer=None`, which was already a no-op. The third passed layer="z_l", interface="z_i" on a grid declaring only X and Y axes; z_l still arrives from T_adx/T_ady (the test's `.sum("z_l")` is unaffected) while z_i is no longer attached to the section output, since no axis of that grid registers z_l at "center". Nothing reads z_i, and no assertion or tolerance changed. - examples/1..5: the same 8 notebook call sites, re-executed. - .github/workflows/ci.yml: drop the `sectionate @ git+...@topology-driven-neighbors` install. It was dead weight -- the git ref builds from a shallow clone and self-reports 0.1.dev251, and the following `pip install -e .` replaced it with the PyPI pre-release anyway. Its TODO comment, still citing a `>= 0.3.3` floor, goes with it. Measured with sectionate 0.4.0rc2 + xgcm 0.10.1 in a clean venv, before -> after: default suite 48 passed / 10 skipped -> unchanged; REGIONATE_REALDATA_TESTS=1 50 passed / 8 failed (all `TypeError: convergent_transport() got an unexpected keyword argument 'layer'`) -> 58 passed. Confirmed on Python 3.12 and 3.13. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Removed comments regarding package dependencies and installation details.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes
topology-overhaulwork against the pre-releasedsectionate >= 0.4.0rc2.What changed and why
sectionate0.4.0rc2 removed thelayerandinterfacekeyword arguments fromconvergent_transport:Upstream that is hdrake/sectionate#7, "Take the vertical coordinates from the data and the grid; drop layer/interface". The reasoning there: the layer (cell-center) coordinate is a dimension of
utr/vtrthemselves, so it already rides along into the section — naming it only re-attached a coordinate that was on the output either way. The interface coordinate genuinely cannot ride along (it is one point longer, so it is a dimension of nothing on the section), but the grid knows it without being told: whichever axis registers the transports' layer dimension at its"center"position names the interface at"outer"/"inner"/"left"/"right". So neither parameter is needed, both were removed rather than re-validated, and passing either now raisesTypeError.regionate's library code never passed them — only the real-grid tests and the example notebooks did. This PR bumps the floor and updates those call sites.
pyproject.tomlsectionate >= 0.4.0rc1→>= 0.4.0rc2regionate/tests/test_real_grids.pylayer=/interface=examples/1..5*.ipynb.github/workflows/ci.ymlsectionateinstall + its stale TODONo assertion, tolerance, or substantive check was changed. The tests still verify exactly what they did before (the discrete divergence theorem, the Arctic-fold single-region trace, the ECCO hard-topology closures).
The one behavioral difference, and why it is inert
Two of the three test call sites passed
layer=None, which was already a no-op. The third passedlayer="z_l", interface="z_i"on a grid that declares onlyXandYaxes. Under rc2 I confirmed empirically on that exact grid:z_lstill arrives on the section output, with the right values ([3000]), because it is a dimension ofT_adx/T_ady. The test's.sum("z_l")is unaffected and the summed value is unchanged.z_iis no longer attached, because no axis of that grid registersz_lat"center"for_interface_coordsto read the interface name off.Nothing in regionate or its examples reads
z_i— it is only ever created, in the two data-setup blocks. So the loss has no consumer and no number moved. If we later wantz_ito keep riding along, the upstream-intended fix is to declare the vertical axis on thexgcm.Grid("Z": {"center": "z_l", "outer": "z_i"}) rather than to name it at the call site; I did not do that here because it is a separate change with no current consumer. Flagging it as a judgement call worth a second opinion.The pre-release floor resolves without
--preThe CI comment asserts this, so I checked it rather than assuming. A clean venv (pip 26.2.1),
pip install --dry-run -e ., no--pre:A pre-release floor permits pre-releases of that package, so neither
--prenor a git ref is needed in CI.Test counts actually measured
Clean venv, Python 3.12.7,
sectionate==0.4.0rc2,xgcm==0.10.1,xarray 2026.7.0,regionmask 0.13.0:5e4a17b, on rc2)pytest -qREGIONATE_REALDATA_TESTS=1 pytest -qEvery one of the 8 failures was
TypeError: convergent_transport() got an unexpected keyword argument 'layer'. Both suites were re-confirmed on a second clean venv at Python 3.13.9 with the same pins: 48 passed / 10 skipped and 58 passed.For reference, the same commit on
sectionate==0.4.0rc1gave 48/10 and 58 passed — i.e. rc1 was already green, and this PR restores that on rc2.Notebooks: re-executed
Yes — re-executed, in a clean venv pinned to the authoritative versions (
sectionate==0.4.0rc2,xgcm==0.10.1), on Python 3.13.9 withmatplotlib==3.10.3andcartopy==0.25.0chosen to match the toolchain the committed outputs were produced with. All five ran end to end with no errors.I diffed every human-readable output (stdout streams and
text/plainresults) cell by cell, before vs after. Every substantive line is byte-identical — includingCheck whether the discrete Divergence Theorem holds: [[ True]](nb 1) anddivergence-theorem residual = 0.00e+00(nb 5). Dropping the kwargs moved no number anywhere in the examples.Exactly two textual lines differ, both machine-specific paths inside warnings, neither related to this change:
3_Arctic_heat_CM4p25.ipynb— the xgcm experimental north-foldUserWarningprints the emitting file's absolute path. It changes from your…/envs/regionate-pr22/…to my clean venv's path under/private/tmp/…/scratchpad/nb313/…. You will probably want to regenerate this one cell locally so the docs don't carry a scratch path; I left the genuine output rather than hand-editing it.4_bounded_by_named_sections.ipynb— atight_layoutwarning quoting theipykernel_<pid>temp path, which changes on any re-execution on any machine.The plot images also churn: PNG payloads shift slightly (different font/DPI metrics on this machine) even with matplotlib pinned to the same 3.10.3. That is unavoidable re-execution noise, not a change in what is plotted.
What I chose not to do
convergent_transportno longer acceptslayer=would be testing sectionate's API from the wrong repo; upstream already covers it (TypeErrorfor both removed keywords).Zaxis on the fold test's grid or onexamples/load_example_model_grid.py'sconstruct_grid, which would restore thez_icoordinate on section output. See above — no consumer, and it is a separate decision.docs/requirements.txt; it had already dropped its git-ref line.Uncertainty a reviewer should resolve
3_Arctic_heat_CM4p25.ipynb's warning output is acceptable, or should be regenerated locally.z_icoordinate on section output is fine (I believe it is — nothing reads it) or whether the grids should declare their vertical axis.main, so this PR intotopology-overhaulwill not run it. My evidence for the CI edit is the local dry-run resolution above, not a green run.🤖 Generated with Claude Code