Reason or Problem
The .xrs accessor exposes only four of the seven public morphology functions. morph_erode, morph_dilate, morph_opening, and morph_closing have accessor methods on both XrsSpatialDataArrayAccessor and XrsSpatialDatasetAccessor. morph_gradient, morph_white_tophat, and morph_black_tophat do not.
All seven functions are public. They are re-exported from xrspatial/__init__.py, documented with full docstrings, and covered by tests (test_morphology_derived.py). Calling da.xrs.morph_erode(...) works, but da.xrs.morph_gradient(...) raises AttributeError. The accessor surface is inconsistent within one function family.
This looks like an oversight rather than a design choice. The four base ops landed in #949, their accessor methods in #1042. The three derived ops landed later in #1026, and the accessor was never updated to match.
Proposal
Add accessor methods for the three derived functions to both accessor classes, following the existing forwarding pattern:
def morph_gradient(self, **kwargs):
from .morphology import morph_gradient
return morph_gradient(self._obj, **kwargs)
Value: every public morphology function becomes reachable through .xrs.
Drawbacks
None. The change is additive and does not touch existing methods.
Stakeholders and Impacts
Users of the .xrs accessor for morphological operations. No impact on the direct function API.
Reason or Problem
The
.xrsaccessor exposes only four of the seven public morphology functions.morph_erode,morph_dilate,morph_opening, andmorph_closinghave accessor methods on bothXrsSpatialDataArrayAccessorandXrsSpatialDatasetAccessor.morph_gradient,morph_white_tophat, andmorph_black_tophatdo not.All seven functions are public. They are re-exported from
xrspatial/__init__.py, documented with full docstrings, and covered by tests (test_morphology_derived.py). Callingda.xrs.morph_erode(...)works, butda.xrs.morph_gradient(...)raisesAttributeError. The accessor surface is inconsistent within one function family.This looks like an oversight rather than a design choice. The four base ops landed in #949, their accessor methods in #1042. The three derived ops landed later in #1026, and the accessor was never updated to match.
Proposal
Add accessor methods for the three derived functions to both accessor classes, following the existing forwarding pattern:
Value: every public morphology function becomes reachable through
.xrs.Drawbacks
None. The change is additive and does not touch existing methods.
Stakeholders and Impacts
Users of the
.xrsaccessor for morphological operations. No impact on the direct function API.