Skip to content

Migrate pathfinding user guide off datashader#3558

Open
brendancol wants to merge 4 commits into
mainfrom
issue-3460
Open

Migrate pathfinding user guide off datashader#3558
brendancol wants to merge 4 commits into
mainfrom
issue-3460

Conversation

@brendancol

Copy link
Copy Markdown
Contributor

Summary

  • Migrate the pathfinding user guide notebook off datashader, part of removing datashader as a dependency (final packaging removal tracked in Drop datashader from packaging and install docs #3450).
  • Build the line network from shapely LineStrings and rasterize it with grid.xrs.rasterize(...) instead of datashader.Canvas().line() / .points().
  • Replace shade / stack / dynspread / set_background and the datashader colormaps with matplotlib (plot.imshow, ListedColormap, Patch legends).
  • Switch the unweighted/weighted path colors from red/green to orange/blue so the figures read for colorblind viewers.
  • Update the prose cell that named the old red/green colors.

The notebook runs top to bottom with no datashader import. The cost_distance and dask validation cells both still report Match: True.

Backend coverage

Docs-only change. No source code touched, so all four backends (numpy / cupy / dask+numpy / dask+cupy) are unaffected.

Test plan

  • jupyter nbconvert --execute runs the notebook top to bottom with no errors
  • No remaining datashader references in the notebook
  • Replacement deps (geopandas, shapely, matplotlib) are present in the doc/tests extras the docs CI build installs

Closes #3460

https://claude.ai/code/session_01TEXdRkRqYJKvATjquz26Pa

Build the line network with shapely LineStrings and burn it onto the
grid with xrs.rasterize instead of datashader's Canvas. Render the
network, paths, terrain, friction, and multi-stop route with
matplotlib. Switch the unweighted/weighted path colors from red/green
to orange/blue so the figures read for colorblind viewers.

Closes #3460

Claude-Session: https://claude.ai/code/session_01TEXdRkRqYJKvATjquz26Pa

@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: Migrate pathfinding user guide off datashader

Docs-only change: one notebook, no source code touched. I read the full notebook from the PR worktree and re-ran it.

Blockers (must fix before merge)

None.

Suggestions (should fix, not blocking)

None.

Nits (optional improvements)

  • The path overlays are single-pixel lines on the 600x400 terrain (cells 17 and 22). The old code used dynspread(..., max_px=2) to thicken them. The path is visible in the rendered figures but thin. If it reads too faint in the built docs, a small thickening or a thicker scatter would help. Not blocking.

What looks good

  • The shapely segment list matches the original datashader xs/ys network exactly (checked the NaN-split segments against the original).
  • grid.xrs.rasterize(lines, column="value", fill=0) is the right call: on-line cells get 1, everything else stays 0, which is what a_star_search(..., barriers=[0]) expects.
  • Red/green path colors swapped for orange/blue, and the prose cell that named the colors was updated to match.
  • import pandas as pd was dropped since the datashader DataFrame construction is gone and nothing else used it.
  • The cost_distance and dask validation cells still print Match: True after the migration.
  • datashader stays in the examples extra (other notebooks still use it); the packaging removal is left to #3450.

Checklist

  • Notebook runs top to bottom with no datashader import
  • Line network matches the original data
  • Replacement deps (geopandas, shapely, matplotlib) available in the docs CI extras
  • No orphaned imports
  • Colorblind-safe path colors
  • Backend parity / numerical tests: N/A (docs-only, no source change)
  • README feature matrix: N/A (no new function)

The single-pixel A* paths were hard to see on the terrain basemap once
dynspread was gone. Add a small path_overlay helper that grows the path
footprint by one pixel before plotting.

Claude-Session: https://claude.ai/code/session_01TEXdRkRqYJKvATjquz26Pa

@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.

Follow-up review (after c9e6b68)

The one nit from the first pass is addressed.

  • Added a path_overlay(path, grow=1) helper in cell 17 that grows the path footprint by one 4-connected pixel and returns 1.0 on the path / NaN elsewhere. Cells 17 and 22 now plot through it, so the terrain routes read clearly on the basemap.
  • The helper is pure numpy (no new dependency) and preserves the path's dims and coords.
  • Re-ran the notebook end to end: no datashader, and the cost_distance and dask validation cells still print Match: True.

No remaining blockers, suggestions, or nits.

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.

Migrate pathfinding user guide off datashader

1 participant