Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .claude/sweep-documentation-state.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ classify,2026-06-25,3506,MEDIUM,1;3,"Cat3: reclassify (numpy/dask/cupy blocks) +
fire,2026-06-25,,MEDIUM,1;5,"all 7 public funcs (dnbr, rdnbr, burn_severity_class, fireline_intensity, flame_length, rate_of_spread, kbdi) lacked Examples section (Cat1 MEDIUM) and backend-support note (Cat5 MEDIUM); fixed in deep-sweep-documentation-fire-2026-06-25-01; repo issues disabled so no issue number; examples run and outputs match numpy backend; all 7 listed in reference/fire.rst; no Cat2/Cat3/Cat4 issues",7/7
flood,2026-06-25,,HIGH,1;4;5,"Cat4 HIGH: vegetation_roughness, vegetation_curve_number, flood_depth_vegetation public but absent from reference/flood.rst; Cat1 MEDIUM: no Examples on any of 7 public funcs; Cat5 MEDIUM: backend support undocumented (all 4 backends) + NaN propagation undocumented for curve_number_runoff/travel_time. Fixed in deep-sweep-documentation-flood-2026-06-25: added 3 rst entries, Examples+backend Notes to all 7 funcs (examples executed OK on CUDA host), NaN notes. PR #3502 opened with the fix; gh issue create blocked by auto-mode classifier so no issue number.",7/7
geotiff,2026-06-25,,MEDIUM,1,"to_geotiff (public write entry point) had Parameters/Returns/Raises but no Examples section while open_geotiff does (Cat1 MEDIUM); added Examples block (plain GeoTIFF, cog=True, .vrt mosaic) modeled on open_geotiff; fixed on deep-sweep-documentation-geotiff-2026-06-25; repo issues disabled so no issue number. Cat2/3/4/5 clean: open_geotiff/to_geotiff signature-docstring parity locked by parity/test_signature_contract.py + write/test_bigtiff.py + test_polish.py; both funcs in autosummary in reference/geotiff.rst; reference page mirrors SUPPORTED_FEATURES tiers (tier-parity gate); CUDA available, all docstring examples are +SKIP illustrative only",2/2
interpolate-idw,2026-06-26,,MEDIUM,1;5,"Cat1 MEDIUM: idw (only public func in _idw.py) had Parameters/Returns/Raises but no Examples section. Cat5 MEDIUM: backend support undocumented (numpy/cupy/dask+numpy/dask+cupy via ArrayTypeFunctionMapping) + k-nearest GPU rejection (NotImplementedError) and NaN/inf input-point dropping undocumented. Doc-only fix on deep-sweep-documentation-interpolate-idw-2026-06-26: added backend-support line, Examples block (executed, output matches), Returns dtype/NaN/fill_value notes. Cat2 clean (all 9 params documented, defaults/types match signature). Cat3 n/a (no prior examples). Cat4 clean (idw listed in reference/interpolation.rst autosummary). CUDA available: ran numpy example; cupy/dask paths covered by test_interpolation.py (92 pass). repo issues disabled so no issue number.",1/1
perlin,2026-06-23,,MEDIUM,2;5,"name param undocumented (Cat2) + float-dtype requirement/ValueError undocumented, no Raises section (Cat5); fixed in deep-sweep-documentation-perlin-2026-06-23; repo has issues disabled so no issue number; example runs and output matches; 1 public func (perlin) listed in reference/surface.rst",1/1
templates,2026-06-26,3541,MEDIUM,3;5,"Cat3/Cat5 MEDIUM: from_template docstring example 'from_template(""FRA"", preserve=""shape"").attrs[""crs""]' showed 32631/UTM 31N but code returns 32630/UTM 30N (GADM FRA bbox includes overseas territories, centroid lon -2.98 -> UTM 30N; code correct per documented centroid-UTM contract). Doc-only fix on deep-sweep-documentation-templates-2026-06-26; issue #3541, PR pending. Both public funcs (from_template, list_templates) fully documented and in reference/templates.rst (no Cat1/Cat2/Cat4). CUDA available: ran all docstring examples incl. preserve paths; 63/63 test_templates.py pass.",2/2
25 changes: 25 additions & 0 deletions xrspatial/interpolate/_idw.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,12 @@ def idw(x, y=None, z=None, template=None, power=2.0, k=None,
fill_value=np.nan, name='idw', *, column=None):
"""Inverse Distance Weighting interpolation.

Supports NumPy, CuPy, Dask with NumPy, and Dask with CuPy backed
templates; the output backend matches the *template*. The k-nearest
mode (``k`` is not ``None``) runs on the CPU backends only (NumPy and
Dask with NumPy); GPU templates require ``k=None`` and raise
``NotImplementedError`` otherwise.

Parameters
----------
x, y, z : array-like
Expand All @@ -311,13 +317,32 @@ def idw(x, y=None, z=None, template=None, power=2.0, k=None,
Returns
-------
xr.DataArray
Interpolated raster (float64) on the same grid, coords, dims, and
attrs as *template*. Input points containing NaN/inf in any of
*x*, *y*, *z* are dropped before interpolation; pixels with zero
total weight take *fill_value*.

Raises
------
MemoryError
When ``k`` is set on a numpy-backed template and the
``(grid_pixels, k)`` distance and index arrays from the
``cKDTree`` query would exceed 80% of available memory.

Examples
--------
.. sourcecode:: python

>>> import numpy as np, xarray as xr
>>> from xrspatial.interpolate import idw
>>> template = xr.DataArray(
... np.zeros((2, 2)),
... dims=["y", "x"],
... coords={"y": [1.0, 0.0], "x": [0.0, 1.0]},
... )
>>> idw([0.0, 1.0], [0.0, 1.0], [0.0, 10.0], template).values
array([[ 5., 10.],
[ 0., 5.]])
"""
x, y, z = resolve_xyz(x, y, z, column=column, func_name='idw')
_validate_raster(template, func_name='idw', name='template')
Expand Down
Loading