# Flood Riverine — Etiopia Melkadida, 12 June 2026

## Setup
- **AOI**: 41.68-42.10°E, 4.22-4.52°N (~154,764 ha), Melkadida District, Somali Region, Ethiopia
- **DTM**: `DTM_UTM37_100_Croped.tif` (FathomDEM 30m, UTM37N EPSG:32637, 6.3 MB)
- **Watershed per streams**: soglia 1100 (100 ha per bacino), Strahler max = 5

## Workflow Debug Log

### 1. Watershed — streams generation
- Location creata dal DTM in UTM37N
- Soglia: 1100 (~100 ha per bacino)
- Output: 1,128 stream lines, 1,116 watersheds
- Strahler distribution: 1(485), 2(283), 3(134), 4(38), 5(39)
- **Buona distribuzione** — reticolo ben gerarchizzato

### 2. Stream extraction per HAND
- MAX_STR rilevato: 5 → arteria principale: Strahler ≥ 5
- v.extract su streams con strahler ≥ 5 → stream lines per HAND

### 3. HAND calculation
- r.grow.distance su river_elev → distanza + elevazione propagata
- r.mapcalc "hand = dem_crop - river_elev_prop" → HAND in metri

### 4. Flood classification
- Soglie: ≤2m=Very_High, 2-4m=High, 4-5m=Medium, 5-6m=Low, >6m=Safe
- Usato `r.mapcalc` con espressioni booleane

### 5. AOI reprojection (critical!)
- AOI era in WGS84 (EPSG:4326), ma la location GRASS in UTM37N
- Riproiettato via `ogr2ogr -t_srs EPSG:32637 AOI_UTM.shp AOI_WGS84.shp`
- SKILL.md ora documenta questo pitfall

### 6. Smooth + vectorize
- r.neighbors size=5 mode → smooth
- 566 poligoni finali (molto meno dei 9327 clumps iniziali)

### 7. area_ha fix
- `v.to.db unit=hectares` → NULL nel DBF (come sempre)
- Fix: `ogr2ogr GPKG` + `UPDATE flood_hazard SET area_ha = ROUND(ST_Area(geom) / 10000.0, 1)`

## Results
| Classe | Soglia HAND | Area (ha) | % AOI |
|---|---|---|---|
| Very_High | ≤ 2m | 1,089 | 0.7% |
| High | 2-4m | 3,499 | 2.3% |
| Medium | 4-5m | 5,253 | 3.4% |
| Low | 5-6m | 4,533 | 2.9% |
| Safe | > 6m | 139,091 | 89.9% |

Totale a rischio (≤ 6m): 14,374 ha (9.3%)

## Strahler filter run (su richiesta)
- "Solo Strahler 4 e 5" → `v.extract where="strahler >= 4"`
- Aumento dell'area a rischio: Very_High 8,317 ha, High 7,384 ha
- Non salvato come skill update (richiesta esplicita: "NON aggiornare la skill")

## Output files
- `ethiopia_flood_hazard.shp` / .tif / .gpkg / .zip (→ delivered via HTTP :8088)
- Dimensioni: shp 824KB, tif 1.6MB, gpkg 1.2MB, zip 592KB
