stream_order_d8: accept method alias; basins_d8: emit DeprecationWarning#2716
Open
brendancol wants to merge 3 commits into
Open
stream_order_d8: accept method alias; basins_d8: emit DeprecationWarning#2716brendancol wants to merge 3 commits into
method alias; basins_d8: emit DeprecationWarning#2716brendancol wants to merge 3 commits into
Conversation
…ing (#2709) stream_order_d8 now accepts a method kwarg as an alias for ordering, matching the parameter name used by stream_order_dinf and stream_order_mfd. ordering keeps working unchanged so existing callers and the routing dispatcher are unaffected; passing both with conflicting values raises ValueError. basins_d8 (a backward-compat wrapper for basin_d8) now emits a DeprecationWarning, matching its docstring guidance.
…2709) - Normalize ordering/method case before the conflict check so an explicit ordering='Strahler' alongside method='shreve' is not flagged as a conflict. - Type method as 'str | None' to match its None default and the docstring. - Add a regression test for the case-insensitive non-conflict path.
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.
Closes #2709
What changed
stream_order_d8now accepts amethodkeyword as an alias forordering. This matchesstream_order_dinfandstream_order_mfd, which already name the strahler/shreve selectormethod.orderingkeeps working, so existing callers and thestream_order(routing=...)dispatcher (which passesordering=) are unaffected. Passing bothorderingandmethodwith conflicting values raisesValueError.basins_d8(the backward-compatible wrapper forbasin_d8) now emits aDeprecationWarning, which its docstring already pointed users toward.A full rename of
orderingtomethodwas avoided on purpose: the dispatcher inxrspatial/hydro/__init__.py(out of scope for this D8 sweep) passesordering=straight to the D8 path, so deprecatingorderingnow would warn on every unifiedstream_order(routing='d8')call.Backend coverage
The selector is a plain string passed to every backend, so the alias behaves the same on numpy, cupy, dask+numpy, and dask+cupy. Verified
method/orderingparity on numpy and on a cupy DataArray.Test plan
methodalias produces the same result asordering(numpy)methodparity on a cupy DataArraymethodvalue raisesValueErrorordering+methodraisesValueErrorbasins_d8emitsDeprecationWarningand still returns the basin result