Commit 1f36ee5
authored
Replace datashader with matplotlib in user guide notebooks (#1002)
* Replace datashader with matplotlib in user guide notebooks (#1001)
Remove datashader as the rendering backend from all 12 affected user
guide notebooks. Each datashader call is replaced with the appropriate
matplotlib or xrspatial equivalent:
- shade/stack -> plt.imshow overlays with alpha compositing
- dynspread -> ax.scatter for points, ax.plot for lines
- Canvas.points/line -> manual DataArray creation or shapely + rasterize
- set_background -> ax.set_facecolor
- datashader.colors.Elevation -> matplotlib 'terrain' cmap
- Images side-by-side -> plt.subplots grid
Notebooks converted: 1_Surface, 2_Proximity, 3_Zonal, 4_Focal,
5_Classification, 6_Remote_Sensing, 7_Pathfinding, 8_Emerging_Hotspots,
11_Hydrology, 12_Flood_Analysis, 13_Fire_Analysis, 30_Zonal_Crosstab.
* Fix rasterize API usage and notebook cell format (#1001)
- Add numeric column to GeoDataFrame in 2_Proximity and 7_Pathfinding
so rasterize() has a value to burn
- Use like= keyword for template DataArray instead of positional arg
- Fix 6_Remote_Sensing cell source format (string → list of strings)
* Fix invisible overlay colors in 1_Surface notebook (#1001)
Use ListedColormap with explicit colors instead of gradient colormaps
(Reds, Greens, cool) for binary mask overlays. When all unmasked values
are identical, gradient cmaps normalize vmin=vmax and render as white.
* Fix curvature zfactor in 1_Surface so overlay is visible (#1001)
zfactor=1 produces curvature values in [-0.05, 0.06], far below the
thresholds of 0.5 and 1.0 used for the overlay masks. Bump to
zfactor=100 which gives values in [-4.6, 6.1], matching the documented
range for hilly terrain.
* Reuse single terrain and use xarray filtering in 1_Surface (#1001)
- Remove separate terrain generation for curvature; reuse the initial
terrain throughout the notebook
- Replace numpy .data assignment with xarray .where() for slope,
curvature, and aspect filtering
- Adjust curvature thresholds to match the default terrain's value range
* Fix viewshed visualization in 1_Surface (#1001)
- Mask on viewshed == -1 (not visible) instead of NaN, which is what
the function actually returns for blocked cells
- Lower observer_elev from 100 to 5 so roughly 30% of terrain is
occluded, making the viewshed result visually obvious
- Use ListedColormap for viewshed overlay consistency
* Add composite risk map, colorblind fixes, and viewshed notebook (#1001)
- Add composite avalanche risk map combining slope, aspect, and curvature
- Fix curvature colors from red/green to orange/blue for colorblind users
- Add legends to all overlay plots (slope, curvature, aspect)
- Reframe aspect-slope map section as a cartographic bonus
- Split viewshed examples into separate 31_Viewshed notebook
- Move preview image to images/ directory
* Add user-guide-notebook command for creating/refactoring notebooks (#1001)
Captures the conventions from the 1_Surface.ipynb work: cell structure,
xarray.plot usage, colorblind-safe palettes, legends, humanizer pass,
and file organization.
* Refactor 2_Proximity notebook and update user-guide-notebook command (#1001)
- Rewrite 2_Proximity with xarray.plot, legends, colorblind-safe colormaps,
humanized markdown, and coverage-planning narrative
- Fix rasterize NaN bug (fillna before astype int) in line proximity
- Use twilight cyclic colormap for direction, tab10 for allocation zones
- Add distance assumptions warning as alert-warning box
- Add direction preview image
- Update command: require 1-3 GIS alert boxes per notebook, eye-candy
preview image with generation instructions
* Refactor 3_Zonal notebook and move alerts to relevant sections (#1001)
Rewrote 3_Zonal with xr.DataArray.plot.imshow, legends, colorblind-safe
palettes, and side-by-side crop visualization. Moved alert boxes in both
2_Proximity and 3_Zonal to sit next to the section they apply to instead
of clustering at the top. Updated user-guide-notebook command to match.
* Update alert box placement: evaluate per-section, place at end (#1001)
* Refactor 4_Focal notebook and update What you'll build sections (#1001)
Rebuild 4_Focal.ipynb to match established notebook structure: proper
cell sequence, xr.DataArray.plot.imshow everywhere, legends on overlays,
colorblind-safe palettes, GIS alert boxes, and new sections for mean
smoothing and focal_stats. Switch hotspots base layer to gray hillshade
so overlay colors pop. Add focal_hotspots_preview.png.
Update What you'll build cells in 2_Proximity, 3_Zonal, and 4_Focal to
use ordered lists summarizing each step. Update user-guide-notebook
command to specify the ordered-list format.
* Refactor 5_Classification notebook, add title format to all notebooks (#1001)
Rebuild 5_Classification.ipynb: equal interval, quantile, natural breaks
with side-by-side comparison, custom reclassify with named elevation
bands, and connected-component regions. Add preview image.
Update notebook command to specify title format:
"Xarray-Spatial {module}: {tools covered}" with a real-world subtitle.
Apply the new format to all five notebooks (1_Surface through
5_Classification). Convert all What you'll build cells to ordered lists.
* Remove Esri/ArcGIS references and refactor notebooks 5, 8, 9 (#1001)
Strip ArcGIS links from Hydrology, Surface, Corridor, Proximity,
Viewshed, and Cost Distance notebooks. Refactor Emerging Hotspots
and Cost Distance notebooks to match established structure.
* Refactor 6_Remote_Sensing and 7_Pathfinding notebooks (#1001)
Remote Sensing: self-contained with synthetic spectral bands from
terrain elevation. Covers true color, NDVI, SAVI, ARVI, EVI, NBR,
and NDMI.
Pathfinding: redesigned with a 20x20 open grid so connectivity
differences are immediately visible. 8-conn gives a clean diagonal,
4-conn gives a staircase, friction-weighted curves around expensive
cells.1 parent 2ebab21 commit 1f36ee5
File tree
25 files changed
+3457
-3289
lines changed- .claude/commands
- examples/user_guide
- images
25 files changed
+3457
-3289
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
0 commit comments