Skip to content

Add landuse module (ESA WorldCover) with Manning roughness#11

Merged
rehsani merged 1 commit into
mainfrom
step-4-landuse-and-roughness
May 4, 2026
Merged

Add landuse module (ESA WorldCover) with Manning roughness#11
rehsani merged 1 commit into
mainfrom
step-4-landuse-and-roughness

Conversation

@rehsani
Copy link
Copy Markdown
Owner

@rehsani rehsani commented May 4, 2026

Summary

  • New `floodpath.landuse` module: ESA WorldCover 10 m global land-cover via `/vsicurl/` window reads on the public AWS Open Data S3 bucket (eu-central-1). Supports 2020 v100 and 2021 v200 releases.
  • `landuse_to_roughness` + `RoughnessGrid` derive Manning's n from any categorical landuse raster. Default `WORLDCOVER_MANNING_N` mapping uses Chow 1959 Table 5-6 / USACE EM 1110-2-1417 floodplain values (n=0.025 for water/bare, n=0.150 for dense tree cover); fully overridable for site-calibrated work.
  • One small unrelated safety fix bundled: `.pypirc` added to `.gitignore`.

Module surface

Item What
`get_worldcover_landuse(lat, lon, buffer_deg, year)` Fetch a WorldCover patch as a `LanduseGrid`
`LanduseGrid` Categorical raster + `class_counts()` / `class_name()` / `fraction()`
`landuse_to_roughness(landuse, mapping=None, fallback=0.035)` Pure transformation to Manning's n
`RoughnessGrid` n raster + active mapping + fallback (introspectable)
`WORLDCOVER_CLASSES`, `WORLDCOVER_MANNING_N` Default reference tables

Test plan

  • `pytest -m "not integration"` — 154 passed (137 prior + 17 new roughness tests, plus the existing 28 landuse tests; 13 deselected integration)
  • `pytest -m "integration" tests/landuse` — 3 passed: live ESA fetch in Djibouti for both 2020 and 2021 + Robit Bata fixture regression check
  • End-to-end smoke test on Robit Bata: 13 stages all succeed, dominant class `cropland (86.2%)`, mean n=0.0455 matches pinned test values
  • Committed fixture is 40 KB (`tests/fixtures/robit_bata_worldcover.tif`, 900x900) — well under the per-fixture budget

Notes

  • `get_worldcover_landuse` uses `/vsicurl/` (DEM-style) rather than the GHSL-style download-and-cache, because WorldCover tiles are 3deg x 3deg at 10 m (~300 MB each) and the S3 bucket honours HTTP range requests. Caching whole tiles for one bbox would be wasteful.
  • README modules table updated; full quickstart snippet for landuse intentionally deferred to a follow-up commit alongside other docs work.

floodpath.landuse provides a global 11-class land-cover raster from
ESA WorldCover (10 m, AWS Open Data S3) and a derivation of Manning's
roughness coefficient n from the categorical classes for use by future
hydraulic-routing functions.

- floodpath/landuse/worldcover.py: get_worldcover_landuse via /vsicurl/
  window reads (DEM-style; tiles are 3deg COGs that honour HTTP range,
  so no full-tile cache is needed). Supports 2020 v100 and 2021 v200.
- floodpath/landuse/roughness.py: landuse_to_roughness + RoughnessGrid
  + WORLDCOVER_MANNING_N default mapping (Chow 1959 Table 5-6 / USACE
  EM 1110-2-1417 floodplain values: 0.025 for water/bare, 0.150 for
  dense tree cover). Users can pass site-calibrated mappings.
- LanduseGrid carries class_counts(), class_name(), fraction() helpers.
- Tests: 28 landuse + 17 roughness (45 offline, 3 integration) including
  a committed Robit Bata WorldCover fixture (40 KB, 900x900 cells) with
  pinned per-class counts and pinned roughness stats. One live ESA
  fetch regression test guards the fixture.
- Also: add .pypirc to .gitignore (safety; was missed in v0.1.0 release).
@rehsani rehsani merged commit a3b3a69 into main May 4, 2026
1 check passed
@rehsani rehsani deleted the step-4-landuse-and-roughness branch May 4, 2026 16:10
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.

1 participant