|
42 | 42 | "cell_type": "code", |
43 | 43 | "execution_count": null, |
44 | 44 | "id": "imports", |
45 | | - "metadata": { |
46 | | - "execution": { |
47 | | - "iopub.execute_input": "2026-03-13T02:48:12.809031Z", |
48 | | - "iopub.status.busy": "2026-03-13T02:48:12.808873Z", |
49 | | - "iopub.status.idle": "2026-03-13T02:48:15.149242Z", |
50 | | - "shell.execute_reply": "2026-03-13T02:48:15.148679Z" |
51 | | - } |
52 | | - }, |
| 45 | + "metadata": {}, |
53 | 46 | "outputs": [], |
54 | 47 | "source": [ |
55 | 48 | "%matplotlib inline\n", |
|
78 | 71 | "cell_type": "code", |
79 | 72 | "execution_count": null, |
80 | 73 | "id": "load-dem", |
81 | | - "metadata": { |
82 | | - "execution": { |
83 | | - "iopub.execute_input": "2026-03-13T02:48:15.150597Z", |
84 | | - "iopub.status.busy": "2026-03-13T02:48:15.150328Z", |
85 | | - "iopub.status.idle": "2026-03-13T02:48:17.828701Z", |
86 | | - "shell.execute_reply": "2026-03-13T02:48:17.828047Z" |
87 | | - } |
88 | | - }, |
| 74 | + "metadata": {}, |
89 | 75 | "outputs": [], |
90 | 76 | "source": [ |
91 | 77 | "try:\n", |
|
126 | 112 | "cell_type": "code", |
127 | 113 | "execution_count": null, |
128 | 114 | "id": "hydro-setup", |
129 | | - "metadata": { |
130 | | - "execution": { |
131 | | - "iopub.execute_input": "2026-03-13T02:48:17.829970Z", |
132 | | - "iopub.status.busy": "2026-03-13T02:48:17.829696Z", |
133 | | - "iopub.status.idle": "2026-03-13T02:48:18.999397Z", |
134 | | - "shell.execute_reply": "2026-03-13T02:48:18.998831Z" |
135 | | - } |
136 | | - }, |
| 115 | + "metadata": {}, |
137 | 116 | "outputs": [], |
138 | 117 | "source": [ |
139 | 118 | "# Fill depressions, resolve flats, compute flow direction and accumulation.\n", |
|
157 | 136 | "cell_type": "code", |
158 | 137 | "execution_count": null, |
159 | 138 | "id": "basemap", |
160 | | - "metadata": { |
161 | | - "execution": { |
162 | | - "iopub.execute_input": "2026-03-13T02:48:19.000845Z", |
163 | | - "iopub.status.busy": "2026-03-13T02:48:19.000727Z", |
164 | | - "iopub.status.idle": "2026-03-13T02:48:19.338846Z", |
165 | | - "shell.execute_reply": "2026-03-13T02:48:19.338124Z" |
166 | | - } |
167 | | - }, |
| 139 | + "metadata": {}, |
168 | 140 | "outputs": [], |
169 | 141 | "source": [ |
170 | 142 | "# Build a hillshade basemap we'll reuse throughout\n", |
|
214 | 186 | "cell_type": "code", |
215 | 187 | "execution_count": null, |
216 | 188 | "id": "hand", |
217 | | - "metadata": { |
218 | | - "execution": { |
219 | | - "iopub.execute_input": "2026-03-13T02:48:19.340736Z", |
220 | | - "iopub.status.busy": "2026-03-13T02:48:19.340620Z", |
221 | | - "iopub.status.idle": "2026-03-13T02:48:19.901710Z", |
222 | | - "shell.execute_reply": "2026-03-13T02:48:19.901260Z" |
223 | | - } |
224 | | - }, |
| 189 | + "metadata": {}, |
225 | 190 | "outputs": [], |
226 | 191 | "source": [ |
227 | 192 | "hand_raster = xrspatial.hand(flow_dir, flow_accum, dem_filled, threshold=threshold)\n", |
|
265 | 230 | "cell_type": "code", |
266 | 231 | "execution_count": null, |
267 | 232 | "id": "inundation", |
268 | | - "metadata": { |
269 | | - "execution": { |
270 | | - "iopub.execute_input": "2026-03-13T02:48:19.904535Z", |
271 | | - "iopub.status.busy": "2026-03-13T02:48:19.904425Z", |
272 | | - "iopub.status.idle": "2026-03-13T02:48:19.912541Z", |
273 | | - "shell.execute_reply": "2026-03-13T02:48:19.912025Z" |
274 | | - } |
275 | | - }, |
| 233 | + "metadata": {}, |
276 | 234 | "outputs": [], |
277 | 235 | "source": [ |
278 | 236 | "for wl in [2, 5, 10, 20]:\n", |
|
286 | 244 | "cell_type": "code", |
287 | 245 | "execution_count": null, |
288 | 246 | "id": "inundation-viz", |
289 | | - "metadata": { |
290 | | - "execution": { |
291 | | - "iopub.execute_input": "2026-03-13T02:48:19.913599Z", |
292 | | - "iopub.status.busy": "2026-03-13T02:48:19.913498Z", |
293 | | - "iopub.status.idle": "2026-03-13T02:48:20.201718Z", |
294 | | - "shell.execute_reply": "2026-03-13T02:48:20.200986Z" |
295 | | - } |
296 | | - }, |
| 247 | + "metadata": {}, |
297 | 248 | "outputs": [], |
298 | 249 | "source": [ |
299 | 250 | "# Visualize the 10 m flood extent\n", |
|
339 | 290 | "cell_type": "code", |
340 | 291 | "execution_count": null, |
341 | 292 | "id": "depth", |
342 | | - "metadata": { |
343 | | - "execution": { |
344 | | - "iopub.execute_input": "2026-03-13T02:48:20.203145Z", |
345 | | - "iopub.status.busy": "2026-03-13T02:48:20.203019Z", |
346 | | - "iopub.status.idle": "2026-03-13T02:48:20.469517Z", |
347 | | - "shell.execute_reply": "2026-03-13T02:48:20.468837Z" |
348 | | - } |
349 | | - }, |
| 293 | + "metadata": {}, |
350 | 294 | "outputs": [], |
351 | 295 | "source": [ |
352 | 296 | "depth = flood_depth(hand_raster, water_level=10)\n", |
|
384 | 328 | "cell_type": "code", |
385 | 329 | "execution_count": null, |
386 | 330 | "id": "cn-scalar", |
387 | | - "metadata": { |
388 | | - "execution": { |
389 | | - "iopub.execute_input": "2026-03-13T02:48:20.470974Z", |
390 | | - "iopub.status.busy": "2026-03-13T02:48:20.470859Z", |
391 | | - "iopub.status.idle": "2026-03-13T02:48:20.478920Z", |
392 | | - "shell.execute_reply": "2026-03-13T02:48:20.478270Z" |
393 | | - } |
394 | | - }, |
| 331 | + "metadata": {}, |
395 | 332 | "outputs": [], |
396 | 333 | "source": [ |
397 | 334 | "# 100 mm rainfall everywhere\n", |
|
419 | 356 | "cell_type": "code", |
420 | 357 | "execution_count": null, |
421 | 358 | "id": "cn-spatial", |
422 | | - "metadata": { |
423 | | - "execution": { |
424 | | - "iopub.execute_input": "2026-03-13T02:48:20.480047Z", |
425 | | - "iopub.status.busy": "2026-03-13T02:48:20.479949Z", |
426 | | - "iopub.status.idle": "2026-03-13T02:48:20.764827Z", |
427 | | - "shell.execute_reply": "2026-03-13T02:48:20.764276Z" |
428 | | - } |
429 | | - }, |
| 359 | + "metadata": {}, |
430 | 360 | "outputs": [], |
431 | 361 | "source": [ |
432 | 362 | "# Simple CN map: low HAND -> urban-ish (CN=85), high HAND -> forested (CN=55)\n", |
|
477 | 407 | "cell_type": "code", |
478 | 408 | "execution_count": null, |
479 | 409 | "id": "tt-inputs", |
480 | | - "metadata": { |
481 | | - "execution": { |
482 | | - "iopub.execute_input": "2026-03-13T02:48:20.766341Z", |
483 | | - "iopub.status.busy": "2026-03-13T02:48:20.766235Z", |
484 | | - "iopub.status.idle": "2026-03-13T02:48:21.170917Z", |
485 | | - "shell.execute_reply": "2026-03-13T02:48:21.170083Z" |
486 | | - } |
487 | | - }, |
| 410 | + "metadata": {}, |
488 | 411 | "outputs": [], |
489 | 412 | "source": [ |
490 | 413 | "slope_raster = xrspatial.slope(dem_filled)\n", |
|
500 | 423 | "cell_type": "code", |
501 | 424 | "execution_count": null, |
502 | 425 | "id": "tt-compute", |
503 | | - "metadata": { |
504 | | - "execution": { |
505 | | - "iopub.execute_input": "2026-03-13T02:48:21.172210Z", |
506 | | - "iopub.status.busy": "2026-03-13T02:48:21.172107Z", |
507 | | - "iopub.status.idle": "2026-03-13T02:48:21.478814Z", |
508 | | - "shell.execute_reply": "2026-03-13T02:48:21.478274Z" |
509 | | - } |
510 | | - }, |
| 426 | + "metadata": {}, |
511 | 427 | "outputs": [], |
512 | 428 | "source": [ |
513 | 429 | "# Manning's n = 0.03 is typical for natural channels.\n", |
|
534 | 450 | "cell_type": "code", |
535 | 451 | "execution_count": null, |
536 | 452 | "id": "tt-compare", |
537 | | - "metadata": { |
538 | | - "execution": { |
539 | | - "iopub.execute_input": "2026-03-13T02:48:21.481411Z", |
540 | | - "iopub.status.busy": "2026-03-13T02:48:21.481303Z", |
541 | | - "iopub.status.idle": "2026-03-13T02:48:21.491759Z", |
542 | | - "shell.execute_reply": "2026-03-13T02:48:21.491111Z" |
543 | | - } |
544 | | - }, |
| 453 | + "metadata": {}, |
545 | 454 | "outputs": [], |
546 | 455 | "source": [ |
547 | 456 | "# Compare roughness: smoother surface (channel) vs rougher (vegetated hillside)\n", |
|
580 | 489 | "cell_type": "code", |
581 | 490 | "execution_count": null, |
582 | 491 | "id": "final-map", |
583 | | - "metadata": { |
584 | | - "execution": { |
585 | | - "iopub.execute_input": "2026-03-13T02:48:21.493197Z", |
586 | | - "iopub.status.busy": "2026-03-13T02:48:21.493089Z", |
587 | | - "iopub.status.idle": "2026-03-13T02:48:22.232191Z", |
588 | | - "shell.execute_reply": "2026-03-13T02:48:22.231319Z" |
589 | | - } |
590 | | - }, |
| 492 | + "metadata": {}, |
591 | 493 | "outputs": [], |
592 | 494 | "source": [ |
593 | 495 | "# Final composite: 10 m flood scenario\n", |
|
0 commit comments