A documentation audit of xrspatial/pathfinding.py (public functions: a_star_search, multi_stop_search) found three gaps. All fixes are doc-only; no behavior changes.
1. multi_stop_search has no Examples section
Structure check (same pattern as test_multispectral.py::test_docstring_params_match_signature), run 2026-07-08 against main:
multi_stop_search
section Parameters: present
section Returns: present
section Examples: MISSING
>>> lines: 0
a_star_search has a 13-line example; its sibling has none. A runnable example for the fix, verified on this host:
import numpy as np
import xarray as xr
from xrspatial import multi_stop_search
agg = xr.DataArray(np.array([
[0, 1, 0, 0],
[1, 1, 0, 0],
[0, 1, 2, 2],
[1, 0, 2, 0],
[0, 2, 2, 2]
], dtype=np.float64), dims=['lat', 'lon'])
height, width = agg.shape
agg['lon'] = np.linspace(0, width - 1, width)
agg['lat'] = np.linspace(height - 1, 0, height)
path_agg = multi_stop_search(agg, [(3, 0), (1, 2), (0, 1)],
barriers=[0], x='lon', y='lat')
path_agg.attrs['waypoint_order'] # [(3, 0), (1, 2), (0, 1)]
path_agg.attrs['segment_costs'] # [2.8284271247461903, 1.4142135623730951]
path_agg.attrs['total_cost'] # 4.242640687119286
2. a_star_search example block uses a malformed rst directive
xrspatial/pathfinding.py:902:
Three dots instead of two. Every other module writes .. sourcecode:: python; this is the only three-dot occurrence in the codebase:
$ grep -rn '\.\.\. sourcecode' xrspatial/*.py
xrspatial/pathfinding.py:902: ... sourcecode:: python
With three dots it is not a directive, so the rendered API page shows the line as literal text instead of starting a code block. The example itself runs fine when copy-pasted (verified).
3. NaN cells are impassable, but neither docstring says so
_is_not_crossable (pathfinding.py:68-77) treats any NaN surface cell as a barrier regardless of the barriers list, and test_pathfinding.py pins this (input_data_with_nans, the snap tests start on NaN pixels). The friction NaN rule is documented ("NaN or <= 0 marks impassable barriers"), but the surface NaN rule appears in neither public docstring. A user with a NaN-nodata raster cannot tell from the docs that nodata cells are automatically excluded from paths, even with the default barriers=[].
Minor, fixed in passing
y: str, default='y' in a_star_search's Parameters section is missing the space before the colon that numpydoc entries use (y : str).
Not duplicated here
The wrong surface description ("values to bin") and the empty connectivity description are already tracked in #3644 (item 3).
Other checks came back clean: docstring parameters match both signatures exactly, both functions are listed in docs/source/reference/pathfinding.rst, and the backend-support table in a_star_search's docstring was verified by running all four backends (numpy, cupy, dask+numpy, dask+cupy) on this host.
A documentation audit of
xrspatial/pathfinding.py(public functions:a_star_search,multi_stop_search) found three gaps. All fixes are doc-only; no behavior changes.1.
multi_stop_searchhas no Examples sectionStructure check (same pattern as
test_multispectral.py::test_docstring_params_match_signature), run 2026-07-08 against main:a_star_searchhas a 13-line example; its sibling has none. A runnable example for the fix, verified on this host:2.
a_star_searchexample block uses a malformed rst directivexrspatial/pathfinding.py:902:Three dots instead of two. Every other module writes
.. sourcecode:: python; this is the only three-dot occurrence in the codebase:With three dots it is not a directive, so the rendered API page shows the line as literal text instead of starting a code block. The example itself runs fine when copy-pasted (verified).
3. NaN cells are impassable, but neither docstring says so
_is_not_crossable(pathfinding.py:68-77) treats any NaN surface cell as a barrier regardless of thebarrierslist, andtest_pathfinding.pypins this (input_data_with_nans, the snap tests start on NaN pixels). The friction NaN rule is documented ("NaN or<= 0marks impassable barriers"), but the surface NaN rule appears in neither public docstring. A user with a NaN-nodata raster cannot tell from the docs that nodata cells are automatically excluded from paths, even with the defaultbarriers=[].Minor, fixed in passing
y: str, default='y'ina_star_search's Parameters section is missing the space before the colon that numpydoc entries use (y : str).Not duplicated here
The wrong
surfacedescription ("values to bin") and the emptyconnectivitydescription are already tracked in #3644 (item 3).Other checks came back clean: docstring parameters match both signatures exactly, both functions are listed in
docs/source/reference/pathfinding.rst, and the backend-support table ina_star_search's docstring was verified by running all four backends (numpy, cupy, dask+numpy, dask+cupy) on this host.