{ "cells": [ { "cell_type": "markdown", "id": "01c23b65", "metadata": {}, "source": [ "(_patate_reunion)=\n", "# How to simulate a flash flood?" ] }, { "cell_type": "markdown", "id": "02ec10f4", "metadata": {}, "source": [ "This example is taken from the Gardenia tutorial {cite:p}`2013:thiery_didacticiel`.\n", "\n", "This example demonstrates the possibility of modelling flows with fine time\n", "steps. This is particularly useful for modelling floods in small \n", "catchment areas. The catchment corresponding to this example is the\n", "Patate at Durand in the Réunion Island, which covers an area of just over 10\n", "km². The average altitude of the catchment is 977 m, ranging from 40 m at the\n", "outlet to around 1.240 m at upstream, with an average gradient of around 11%.\n", "Given these variations in altitude, it is difficult to calculate a precise water\n", "level.\n", "\n", "This example shows the modelling of the flood resulting from the cyclone that\n", "occurs during 17-19 February 2006. For this period, we have data at 30-minute\n", "intervals of\n", "\n", "- Estimated rainfall over the basin in mm/30 min.\n", "- Hourly flow at the outlet, in m3/s.\n", "\n", "No potential evapotranspiration value is available, but we have chosen a\n", "constant value of 0.1 mm/30 min, i.e. 4.8 mm/day. Each series (Rainfall, PET\n", "and river flows) covers the period from 16 to 19 February 2006, i.e. 4 days, in\n", "half-hour time steps. " ] }, { "cell_type": "markdown", "id": "ec00b857", "metadata": { "vscode": { "languageId": "plaintext" } }, "source": [ "## TOML configuration file\n", "\n", "Not that halflife time values are expressed in time step unit rather than in\n", "month (key `unit_time_step` equal to `true`). Flow coming from the groundwater\n", "reservoir characterized by halflife time value of 10 to 20 with 30-min time\n", "steps are not strictly speeking groundwater flows but rather delayed flow.\n", "\n", "```{literalinclude} model.toml\n", ":language: toml\n", "```" ] }, { "cell_type": "markdown", "id": "6b9d078a", "metadata": {}, "source": [ "## Optimization" ] }, { "cell_type": "code", "execution_count": null, "id": "b26f39e3", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "\n", "import rameau as rm\n", "\n", "# Load model from a toml file\n", "model = rm.Model.from_toml(f\"model.toml\")\n", "\n", "# Run a simulation with parameters defined in the toml file\n", "sim = model.run_optimization()" ] }, { "cell_type": "markdown", "id": "a0a7ad95", "metadata": {}, "source": [ "Metrics are:" ] }, { "cell_type": "code", "execution_count": null, "id": "151f678a", "metadata": {}, "outputs": [], "source": [ "# Print the riverflow metrics\n", "scores = sim.get_metrics(\"riverflow\")\n", "print(scores)" ] }, { "cell_type": "markdown", "id": "10567b64", "metadata": {}, "source": [ "We plot river flow time series resulting from the optimization. Given the\n", "uncertainties over the actual water level in this very small catchment, it\n", "would be difficult to hope for a perfect simulation of the flood peak. It\n", "should be noted that the maximum flow is of the order of 150 m3/s, which is\n", "considerable for a small basin of around 10 km². This flash flood could not be\n", "simulated correctly with a conventional time step of 1 day, for example." ] }, { "cell_type": "code", "execution_count": null, "id": "8f1e707c", "metadata": {}, "outputs": [], "source": [ "# Get the riverflow simulation\n", "riv_sim = sim.get_output(\"riverflow\")\n", "\n", "# Get the riverflow observation\n", "riv_obs = model.get_input(\"riverobs\")\n", "\n", "# Plot river flow\n", "df = pd.DataFrame(\n", " {\n", " \"Obs\":riv_obs.iloc[:, 0],\n", " \"Sim\":riv_sim.iloc[:, 0],\n", " }\n", ")\n", "df.loc[\"1976-01-01\":, :].plot(\n", " grid=True,\n", " title=\"Simulated and observed river flows\",\n", " ylabel=\"m3/s\",\n", " style=[\"-\", \"+\"]\n", ")\n", "plt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "dev", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 5 }