Add interactive outlet picker (ArcSWAT-style) + example notebook#18
Merged
Conversation
…tebook New floodpath.interactive module with a leafmap-based outlet picker: - pick_outlet(lat, lon, ...) returns an OutletPicker showing a grayscale hillshade + Strahler-styled stream network on a CartoDB.Positron basemap - Each click is auto-snapped downstream to the nearest stream cell via pyflwdir, the upstream basin is delineated and overlaid in green - Draggable outlet marker for fine adjustment; drops re-snap and re-delineate in place - OutletSelection bundles outlet, basin, DEM, flow grid, streams so downstream pipeline stages can chain off it without re-fetching Adds floodpath.hydrology.snap_to_stream as the public helper underneath the picker (also surfaces outside-DEM-bbox clicks as ValueError so GUI callers handle one branch). Adds examples/pick_outlet.ipynb walking the full DEM -> flow -> streams -> outlet -> HAND -> flood -> population -> damage chain at Kigali, Rwanda. Optional dep: pip install floodpath[interactive] (adds leafmap, ipyleaflet, matplotlib). Tests: 343 offline tests pass (3 new snap + 8 new interactive).
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.
Summary
floodpath.interactivemodule: leafmap-based outlet picker. Click any pixel in the DEM patch — it auto-snaps downstream to the nearest stream cell, delineates the upstream basin, and overlays it in green. Drag the outlet marker to fine-tune.OutletSelectioncarrying the snapped outlet, basin, DEM, flow grid, and streams so the rest of the pipeline (compute_hand, routing, damage) chains off it without re-fetching.floodpath.hydrology.snap_to_streamas the public helper underneath; surfaces outside-DEM-bbox clicks asValueErrorso GUI callers handle one branch.examples/pick_outlet.ipynbwalking the full DEM → flow → streams → outlet → HAND → flood → population → damage chain at Kigali, Rwanda.pip install floodpath[interactive](leafmap, ipyleaflet, matplotlib).Test plan
pytest -m "not integration"passes (343 tests, +3 snap + 8 interactive vs. baseline)