Skip to content

Reset dask graph-token .name on pathfinding outputs (#3652)#3656

Merged
brendancol merged 2 commits into
mainfrom
deep-sweep-metadata-pathfinding-2026-07-08
Jul 9, 2026
Merged

Reset dask graph-token .name on pathfinding outputs (#3652)#3656
brendancol merged 2 commits into
mainfrom
deep-sweep-metadata-pathfinding-2026-07-08

Conversation

@brendancol

Copy link
Copy Markdown
Contributor

Closes #3652

On dask and dask+cupy backends, a_star_search and multi_stop_search returned DataArrays named after the internal dask graph token ('concatenate-', 'array-') while numpy/cupy returned unnamed results. xr.DataArray picks up data.name when no name is passed, and dask arrays expose their task key there.

All four backends verified locally (CUDA available on this box).

Test plan:

  • pytest xrspatial/tests/test_pathfinding.py (61 passed)
  • probe script confirms .name is None on all four backends for both functions

https://claude.ai/code/session_0155N4QGamQVxgpAAPbpQNq4

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 brendancol left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 _backends list defined at line 273. Reasonable as-is, since _backends deliberately excludes the GPU backends (those tests use the @cuda_and_cupy_available decorator instead), but a shared "all runnable backends" helper in general_checks.py would 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=None to the constructor does not help because xarray falls back to the dask array's .name attribute. Same approach as slope, zonal (#2611), focal (#2733), and proximity (#2728).
  • @supports_dataset on multi_stop_search re-keys per-variable results in a dict, so the None name 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

@brendancol
brendancol merged commit 36d1700 into main Jul 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pathfinding: dask-backed outputs adopt the dask graph token as DataArray.name

1 participant