Add runoff module with SCS Curve Number derivation#13
Merged
Conversation
floodpath.runoff combines ESA WorldCover landuse with NEH 630 Ch7
hydrologic soil group into the per-cell SCS Curve Number raster needed
by the SCS-CN runoff equation
Q = (P - 0.2*S)^2 / (P + 0.8*S), S = 25400/CN - 254 (mm).
This is the second-to-last piece of the rainfall-runoff chain — only
the rainfall fetcher and the equation itself remain.
- floodpath/runoff/curve_number.py: compute_curve_number(landuse, hsg)
walks each (WorldCover code, HSG letter) pair and applies the table
in WORLDCOVER_NEH_CN. SoilGrids HSG (~250 m) is upsampled to the
WorldCover grid (10 m) via rasterio.warp.reproject with nearest-
neighbour resampling (categorical data — averaging would be wrong).
- floodpath/runoff/constants.py: WORLDCOVER_NEH_CN — the 11x4 lookup
table (NEH 630 Ch9 Table 9-1, AMC II) mapping every WorldCover class
to a CN per HSG letter. Mappings cite the chosen NEH cover type
(Woods/Brush/Pasture/Row crops/Residential 1/4 acre/Fallow/...).
- floodpath/runoff/models.py: CurveNumberGrid carries the uint8 CN
raster, stats() that ignore nodata, and potential_retention_mm()
returning S = 25400/CN - 254 ready to plug into the SCS-CN equation.
- Tests: 29 new (constants table invariants, monotonicity vs HSG, S
formula, georef inheritance, fallback behaviour, custom mapping).
Pinned values against the existing Robit Bata WorldCover + soil
fixtures (no new fixture needed): mean CN = 87.72, dominant class
CN = 89 (cropland on D), min/max 77/100.
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
What this enables
`CurveNumberGrid.potential_retention_mm()` returns `S = 25400/CN - 254` ready to feed into `Q = (P - 0.2S)² / (P + 0.8S)`. Once a rainfall source lands (next PR), the SCS-CN equation itself is a 5-line addition.
Module surface
Test plan
Notes