Summary
xrspatial/diffusion.py dispatches to all four backends (numpy, cupy, dask+numpy, dask+cupy) through ArrayTypeFunctionMapping, but xrspatial/tests/test_diffusion.py only exercises numpy and dask+numpy. The cupy and dask+cupy paths, the reflect boundary mode, and single-pixel / strip raster shapes have no tests.
Found by the test-coverage sweep against the diffusion module.
Gaps
Backend coverage:
- The cupy backend (
_diffuse_cupy, _diffuse_step_gpu) is registered in the dispatch table, but nothing invokes it.
- The dask+cupy backend (
_diffuse_dask_cupy, _diffuse_chunk_cupy) is registered, but nothing invokes it.
- No test asserts numpy equals cupy or numpy equals dask+cupy.
Boundary mode:
boundary accepts 'nan', 'nearest', 'reflect', and 'wrap'. Only nearest and wrap are tested. reflect has none.
Geometric edge cases:
- A 1x1 single-pixel raster is never tested.
- An Nx1 / 1xN strip is never tested. These shapes probe kernel-boundary degeneracies.
NaN / Inf:
- NaN is tested on numpy only, never on the GPU or dask backends.
- Inf input and all-NaN input are not tested.
Proposed fix
Add tests only, no source changes. Reuse the cross-backend helpers in general_checks.py so the new tests run on all four backends on a CUDA host. If a test turns up a source bug, file a separate accuracy issue instead of bundling a source fix here.
I ran all of these paths locally on a CUDA host and they produce correct results today, so this is a coverage gap rather than a latent bug.
Summary
xrspatial/diffusion.pydispatches to all four backends (numpy, cupy, dask+numpy, dask+cupy) throughArrayTypeFunctionMapping, butxrspatial/tests/test_diffusion.pyonly exercises numpy and dask+numpy. The cupy and dask+cupy paths, thereflectboundary mode, and single-pixel / strip raster shapes have no tests.Found by the test-coverage sweep against the diffusion module.
Gaps
Backend coverage:
_diffuse_cupy,_diffuse_step_gpu) is registered in the dispatch table, but nothing invokes it._diffuse_dask_cupy,_diffuse_chunk_cupy) is registered, but nothing invokes it.Boundary mode:
boundaryaccepts'nan','nearest','reflect', and'wrap'. Onlynearestandwrapare tested.reflecthas none.Geometric edge cases:
NaN / Inf:
Proposed fix
Add tests only, no source changes. Reuse the cross-backend helpers in
general_checks.pyso the new tests run on all four backends on a CUDA host. If a test turns up a source bug, file a separate accuracy issue instead of bundling a source fix here.I ran all of these paths locally on a CUDA host and they produce correct results today, so this is a coverage gap rather than a latent bug.