Description
Commit 8bb7c16 (#3476/#3477) gave the .xrs accessor a categorized __repr__, so da.xrs and ds.xrs list the available operations grouped by category. That part works.
The problem shows up one level down. Evaluating a single tool without calling it, e.g. da.xrs.slope, prints the entire accessor listing again instead of information about slope:
>>> da.xrs.slope
<bound method XrsSpatialDataArrayAccessor.slope of <XrsSpatialDataArrayAccessor> xarray-spatial tools for this DataArray
call as: .xrs.<name>(...)
Plot:
plot
Surface:
slope, aspect, hillshade, curvature
... (the whole catalog) ...>
da.xrs.slope is a bound method. Python builds a bound method's repr as <bound method Cls.name of {repr(self)}>, and repr(self) now routes through the accessor's custom __repr__, so the full catalog ends up embedded in the bound-method repr.
Expected behavior
Evaluating da.xrs.slope should show information scoped to slope only: its call signature and docstring, the same documentation help(da.xrs.slope) already surfaces. The docstring is already attached to each accessor method (see _attach_delegated_docs), so the per-tool repr can reuse it.
Steps to reproduce
import numpy as np, xarray as xr, xrspatial
da = xr.DataArray(np.ones((4, 4)), dims=['y', 'x'])
da.xrs.slope # prints the whole accessor catalog instead of slope's info
Environment
Description
Commit 8bb7c16 (#3476/#3477) gave the
.xrsaccessor a categorized__repr__, soda.xrsandds.xrslist the available operations grouped by category. That part works.The problem shows up one level down. Evaluating a single tool without calling it, e.g.
da.xrs.slope, prints the entire accessor listing again instead of information aboutslope:da.xrs.slopeis a bound method. Python builds a bound method's repr as<bound method Cls.name of {repr(self)}>, andrepr(self)now routes through the accessor's custom__repr__, so the full catalog ends up embedded in the bound-method repr.Expected behavior
Evaluating
da.xrs.slopeshould show information scoped toslopeonly: its call signature and docstring, the same documentationhelp(da.xrs.slope)already surfaces. The docstring is already attached to each accessor method (see_attach_delegated_docs), so the per-tool repr can reuse it.Steps to reproduce
Environment