Reset dask graph-token .name on pathfinding outputs (#3652)#3656
Merged
Conversation
On dask and dask+cupy backends, a_star_search and multi_stop_search returned DataArrays named after the dask task key while numpy/cupy returned unnamed results. Reset .name post-construction, same as zonal #2611 and focal #2733, and pin with a cross-backend test. Claude-Session: https://claude.ai/code/session_0155N4QGamQVxgpAAPbpQNq4
brendancol
commented
Jul 8, 2026
brendancol
left a comment
Contributor
Author
There was a problem hiding this comment.
PR Review: Reset dask graph-token .name on pathfinding outputs (#3652)
Blockers (must fix before merge)
None.
Suggestions (should fix, not blocking)
None.
Nits (optional improvements)
-
xrspatial/tests/test_pathfinding.py:1150—_name_check_backends()overlaps with the module-level_backendslist defined at line 273. Reasonable as-is, since_backendsdeliberately excludes the GPU backends (those tests use the@cuda_and_cupy_availabledecorator instead), but a shared "all runnable backends" helper ingeneral_checks.pywould serve future cross-backend metadata tests too.
What looks good
- Both public functions have exactly one DataArray construction site, so the post-construction reset covers every backend path (numpy, cupy, dask, dask+cupy, bounded, HPA*).
- Post-construction assignment is the correct mechanism here: passing
name=Noneto the constructor does not help because xarray falls back to the dask array's.nameattribute. Same approach as slope, zonal (#2611), focal (#2733), and proximity (#2728). @supports_datasetonmulti_stop_searchre-keys per-variable results in a dict, so theNonename cannot leak into Dataset variable names.- The regression test asserts the actual property (
.name is None) for both functions and parametrizes over all four backends with runtime gating, so it degrades to numpy+dask on CPU-only hosts instead of skipping wholesale.
Checklist
- Algorithm matches reference: n/a (metadata-only change)
- All implemented backends produce consistent results: yes, verified by the new test on a CUDA host
- NaN handling: untouched
- Edge cases covered: single construction site per function, so no uncovered paths
- Dask chunk boundaries: untouched
- No premature materialization: attribute assignment only
- Benchmark: not needed
- README feature matrix: no API change
- Docstrings: no signature change; existing docstrings make no claims about
.name
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3652
On dask and dask+cupy backends,
a_star_searchandmulti_stop_searchreturned DataArrays named after the internal dask graph token ('concatenate-', 'array-') while numpy/cupy returned unnamed results.xr.DataArraypicks updata.namewhen no name is passed, and dask arrays expose their task key there..name = Nonepost-construction in both functions (same fix as zonal zonal.apply() output .name is inconsistent across backends #2611 and focal focal_stats and hotspots: result .name differs across backends #2733; slope has the same reset).test_output_name_consistent_across_backends, parametrized over numpy / dask+numpy / cupy / dask+cupy (GPU cases skip when CUDA is absent).All four backends verified locally (CUDA available on this box).
Test plan:
pytest xrspatial/tests/test_pathfinding.py(61 passed).name is Noneon all four backends for both functionshttps://claude.ai/code/session_0155N4QGamQVxgpAAPbpQNq4