Add missing morphology accessor methods#3409
Open
brendancol wants to merge 3 commits into
Open
Conversation
Expose morph_gradient, morph_white_tophat, and morph_black_tophat on both the DataArray and Dataset .xrs accessors, matching the four base morphology ops already present. Add accessor tests for the morphology family and guard all seven methods in the expected-methods checks.
brendancol
commented
Jun 20, 2026
brendancol
left a comment
Contributor
Author
There was a problem hiding this comment.
PR Review: Add missing morphology accessor methods
Blockers
None.
Suggestions
None.
Nits
None.
What looks good
- The three new methods follow the existing forwarding pattern byte-for-byte (lazy import,
**kwargspassthrough), so they inherit whatever backend support the underlying functions provide. - Both accessor classes are updated, so DataArray and Dataset stay in sync.
- Tests assert the accessor output is identical to the direct function call, which is the right contract for a thin forwarder.
- The expected-methods checks now list all seven morph methods, so a future regression that drops one gets caught.
Checklist
- Forwards to existing, already-tested morphology functions; no new algorithm
- Backend support inherited from the underlying functions (numpy / cupy / dask+numpy / dask+cupy)
- NaN handling unchanged (delegated)
- Accessor parity tested for DataArray and Dataset
- No materialization or copies introduced
- No benchmark needed (no compute path added)
- No README/docs change needed (accessor methods are not separately documented)
- Matches API conventions (mirrors the four existing morph accessor methods)
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 #3399
The
.xrsaccessor exposed only four of the seven public morphology functions. This adds the missing three to both accessor classes.morph_gradient,morph_white_tophat, andmorph_black_tophatmethods toXrsSpatialDataArrayAccessorandXrsSpatialDatasetAccessor, following the existing forwarding pattern.The change forwards to the existing morphology functions, so backend coverage matches those: numpy, cupy, dask+numpy, dask+cupy.
Test plan:
pytest xrspatial/tests/test_accessor.py(69 passed)