Skip to content

docs(convolution): fill docstring gaps and fix stale examples#3620

Open
brendancol wants to merge 1 commit into
mainfrom
deep-sweep-documentation-convolution-2026-07-02
Open

docs(convolution): fill docstring gaps and fix stale examples#3620
brendancol wants to merge 1 commit into
mainfrom
deep-sweep-documentation-convolution-2026-07-02

Conversation

@brendancol

Copy link
Copy Markdown
Contributor

Documentation-only cleanup for xrspatial/convolution.py, from the deep-sweep documentation pass. No behavior changes; test_convolution.py still passes and flake8 is unchanged (one pre-existing F401 baseline).

What changed

  • custom_kernel: replaced the one-line stub with a full numpydoc docstring (Parameters, Returns, Examples). The example output was run and matches.
  • convolve_2d: added a docstring. It had none, even though it is importable and used by focal/edge_detection/morphology.
  • convolution_2d: the agg parameter listed only NumPy, CuPy, and Dask+NumPy, but the dispatch also provides Dask+CuPy (_convolve_2d_dask_cupy). Now names all four. Also fixed the typos "values to processed" and "CuPybacked".
  • annulus_kernel: the two print(kernel) example blocks showed comma-separated arrays with a stray trailing ). Real print output has no commas or paren. Corrected to the measured output (values were already right).
  • convolution_2d Dask example: the .compute() output claimed dtype=float32, but the np.ones input is float64 and stays float64. Dropped the wrong label.
  • convolution_2d CuPy example: type(...) showed cupy.core.core.ndarray; modern CuPy reports cupy.ndarray. Updated.

Not fixed (LOW, left as-is)

calc_cellsize km example writes its output line as >>> (1000.0, 1000.0) (a stray prompt on an output line). Harmless on copy-paste, so left alone and noted in the sweep state.

Verification

  • numpy, dask, and cupy docstring examples executed on a CUDA host; outputs match.
  • pytest xrspatial/tests/test_convolution.py -> 6 passed.

- custom_kernel: add Parameters/Returns/Examples (was a one-line stub)
- convolve_2d: add a numpydoc docstring (had none)
- convolution_2d: name all four supported backends in the agg param
  (Dask+CuPy was omitted) and fix 'to processed'/'CuPybacked' typos
- annulus_kernel: correct example output to match numpy print (no
  commas, no stray trailing paren)
- convolution_2d dask example: drop wrong dtype=float32 (float64 input
  is preserved); cupy type repr cupy.core.core.ndarray -> cupy.ndarray

Docs only; no behavior change. test_convolution.py passes.

Deep-sweep documentation sweep, module convolution.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant