API consistency sweep finding (Cat 3 MEDIUM)
The public resample() function in xrspatial/resample.py is the only public symbol from the resample module and is missing type annotations on every parameter and on the return type:
def resample(
agg,
scale_factor=None,
target_resolution=None,
method='nearest',
nodata=None,
name='resample',
):
Sibling modules in the terrain family (slope, aspect, hillshade, curvature) all annotate agg: xr.DataArray and declare -> xr.DataArray. Recent sweeps fixed the same gap in rasterize (#2250), polygonize (#2148), and open_geotiff (#2106). The docstring already declares the intended types so this is a doc-vs-signature drift, not new design work.
Impact
- IDE autocompletion, mypy, and Sphinx autodoc silently lose information.
- Users moving between
resample and the annotated terrain family see inconsistent tooling support.
Fix
Add annotations matching the docstring and the @supports_dataset decorator contract:
def resample(
agg: xr.DataArray,
scale_factor: float | tuple[float, float] | None = None,
target_resolution: float | tuple[float, float] | None = None,
method: str = 'nearest',
nodata: float | None = None,
name: str = 'resample',
) -> xr.DataArray:
Also clarify in the docstring that agg accepts xr.Dataset too (the @supports_dataset decorator already handles it).
Notes on findings NOT filed
- Cat 1 cross-module rename
method vs resampling: resample(method=...) vs reproject(resampling=...) / merge(resampling=...). Same conceptual parameter, different name. Cross-cutting and would be a breaking rename in either direction. Documented in sweep state, not filed per-module per template.
- Cat 1 first-arg name
agg vs raster: Library-wide cross-cutting drift. Documented, not filed.
Test plan
cuda-validated: smoke-tested cupy backend with nearest, bilinear, and average methods on host with CUDA_AVAILABLE=True.
API consistency sweep finding (Cat 3 MEDIUM)
The public
resample()function inxrspatial/resample.pyis the only public symbol from the resample module and is missing type annotations on every parameter and on the return type:Sibling modules in the terrain family (
slope,aspect,hillshade,curvature) all annotateagg: xr.DataArrayand declare-> xr.DataArray. Recent sweeps fixed the same gap inrasterize(#2250),polygonize(#2148), andopen_geotiff(#2106). The docstring already declares the intended types so this is a doc-vs-signature drift, not new design work.Impact
resampleand the annotated terrain family see inconsistent tooling support.Fix
Add annotations matching the docstring and the
@supports_datasetdecorator contract:Also clarify in the docstring that
aggacceptsxr.Datasettoo (the@supports_datasetdecorator already handles it).Notes on findings NOT filed
methodvsresampling:resample(method=...)vsreproject(resampling=...)/merge(resampling=...). Same conceptual parameter, different name. Cross-cutting and would be a breaking rename in either direction. Documented in sweep state, not filed per-module per template.aggvsraster: Library-wide cross-cutting drift. Documented, not filed.Test plan
test_rasterize_signature_annot_2250.pythat pins every parameter and the return type as annotated.cuda-validated: smoke-tested cupy backend with
nearest,bilinear, andaveragemethods on host with CUDA_AVAILABLE=True.