Skip to content

Commit

Permalink
Merge pull request #3 from ahmedfarhatx22/Ezzat
Browse files Browse the repository at this point in the history
Ezzat
  • Loading branch information
Ezzat1998 authored Dec 2, 2024
2 parents e8ede23 + e34b00a commit 25704b6
Show file tree
Hide file tree
Showing 30 changed files with 1,019 additions and 48 deletions.
Binary file added book/images/D8_flow_directions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/DEM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/DEM_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question15_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question21.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Question9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/Shreve.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/hillslope.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/topomap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 18 additions & 21 deletions book/recession/recession_intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,60 +34,57 @@
"\n",
"For the relationship between discharge (Q) and storage (S),\n",
"\n",
"<a id=\"eq1\"></a>\n",
"\n",
"$$\n",
"Q=f(S) \\qquad \\qquad \\qquad (1)\n",
"$$ \n",
"\n",
" Q = f(S)\n",
"$$ (eq_1) \n",
"\n",
"it is assumed that $f$ is a strictly monotonically increasing function (i.e.~no hysteresis), that all $Q$ originates from storage and that flow routes (e.g. groundwater flow, macropore flow, overland flow) are only related to catchment storage and not to rainfall intensity.\n",
"\n",
"Under these assumptions the sensitivity of $Q$ to changes in $S$, $f'(S)$, is expressed solely as a function of $Q$ through the so-called discharge sensitivity function $g(Q)$:\n",
"\n",
"<a id=\"eq2\"></a>\n",
"\n",
"\n",
"$$\n",
"g(Q) = \\frac{\\mathrm{d}Q}{\\mathrm{d}S}\\ \\qquad \\qquad \\qquad (2)\n",
"$$\n",
" g(Q) = \\frac{\\mathrm{d}Q}{\\mathrm{d}S}\\ \n",
"$$ (eq_2)\n",
"\n",
"\n",
"This function expresses how sensitive discharge is to changes in catchment storage, or how much discharge will change when storage changes. When the numerator and denominator of the right-hand side are both divided by $\\mathrm{d}t$, and $\\mathrm{d}S/\\mathrm{d}t$ is replaced with the other terms of the water budget equation ($P - ET - Q$), the change of discharge over time can be computed as \n",
"\n",
"<a id=\"eq3\"></a>\n",
"\n",
"$$\n",
"\\frac{\\mathrm{d}Q}{\\mathrm{d}t} = g(Q)~(P-ET-Q)\\ \\qquad \\qquad \\qquad (3)\n",
"$$\n",
" \\frac{\\mathrm{d}Q}{\\mathrm{d}t} = g(Q)~(P-ET-Q)\\ \n",
"$$ (eq2_3)\n",
" \n",
"\n",
"This implies that at a given _initial storage_, a certain change in storage (caused by $P$, $ET$ or $Q$) should always lead to the same discharge response, both in timing and magnitude.\n",
"\n",
"When $P=0$ and $ET=0$ (for instance during night-time hours), the sensitivity function $g(Q)$ can be obtained from data by plotting the recession rate $-\\mathrm{d}Q/\\mathrm{d}t$ against $Q$. In several studies power law relations between $Q$ and $-\\mathrm{d}Q/\\mathrm{d}t$ have been found (e.g. Brutsaert and Nieber, 1977): \n",
"\n",
"\n",
"<a id=\"eq4\"></a>\n",
"$$\n",
"-\\frac{\\mathrm{d}Q}{\\mathrm{d}t} = g(Q) \\cdot Q = a \\cdot Q^{b} \\ , \\qquad \\qquad \\qquad (4)\n",
"\n",
"$$\n",
" -\\frac{\\mathrm{d}Q}{\\mathrm{d}t} = g(Q) \\cdot Q = a \\cdot Q^{b} \\ ,\n",
"$$ (eq2_4)\n",
"\n",
"where $b=1$ corresponds to a linear reservoir. In case of a linear reservoir, the coefficient $a$ is often replaced by $1/k$. In this practical we will use the letters $a$ and $b$ for nonlinear reservoirs and $k$ for linear reservoirs. To obtain recession coefficients $a$ (or $k$) and $b$, you will use three techniques: two types of recession analysis [Sec. 3.3.2](recession_practical.ipynb#recession-analysis) and hydrograph fitting [Sec. 3.3.4](recession_practical.ipynb#rainfall-runoff-modelling). \n",
"\n",
"To simulate the streamflow hydrograph, substitute $g(Q)$ from [eq. 4]() ($a Q^{b-1}$) in [eq. 3](#eq3):\n",
"To simulate the streamflow hydrograph, substitute $g(Q)$ from {eq}`eq2_4` ($a Q^{b-1}$) in {eq}`eq2_3`:\n",
"\n",
"\n",
"<a id=\"eq5\"></a>\n",
"\n",
"$$\n",
"\\frac{\\mathrm{d}Q}{\\mathrm{d}t} = a \\cdot Q^{b-1} \\cdot ( P-ET-Q )\\ . \\qquad \\qquad \\qquad (5)\n",
"$$\n",
" \\frac{\\mathrm{d}Q}{\\mathrm{d}t} = a \\cdot Q^{b-1} \\cdot ( P-ET-Q )\\ . \n",
"$$ (eq2_5)\n",
"\n",
"\n",
"Because this equation can lead to numerical instabilities when integrated, eq.(\\ref{eq:modellin}) is solved in terms of the logarithm of $Q$:\n",
"Because this equation can lead to numerical instabilities when integrated, {eq}`eq2_5` is solved in terms of the logarithm of $Q$:\n",
"\n",
"<a id=\"eq6\"></a>\n",
"\n",
"$$\n",
"\\frac{\\mathrm{d}(\\ln Q)}{\\mathrm{d}t} = a \\cdot Q^{b-1} \\cdot \\left(\\frac{P-ET}{Q}-1 \\right)\\ . \\qquad \\qquad \\qquad (6)\n",
"$$\n",
" \\frac{\\mathrm{d}(\\ln Q)}{\\mathrm{d}t} = a \\cdot Q^{b-1} \\cdot \\left(\\frac{P-ET}{Q}-1 \\right)\\ \n",
"$$ (eq2_6)\n",
"\n",
"\n",
"</ol>\n",
Expand Down
41 changes: 23 additions & 18 deletions book/recession/recession_practical.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
"Remember that when \n",
"\n",
"$$\n",
"-\\frac{\\mathrm{d}Q}{\\mathrm{d}t} = \\frac{Q}{k}\\ \\ , \\qquad \\qquad \\qquad (7)\n",
"$$\n",
"-\\frac{\\mathrm{d}Q}{\\mathrm{d}t} = \\frac{Q}{k}\\ \\ ,\n",
"$$(eq2_7)\n",
"\n",
"the flow out of a linear reservoir can be given by \n",
"\n",
"$$\n",
"Q_t = Q_0 \\cdot e^ {-\\frac{t}{k}}\\ . \\qquad \\qquad \\qquad (8)\n",
"$$\n",
"Q_t = Q_0 \\cdot e^ {-\\frac{t}{k}}\\ .\n",
"$$(eq2_8)\n",
"\n",
"You have to program this curve yourself, but some help is available in the script.\n",
"\n",
Expand Down Expand Up @@ -309,7 +309,7 @@
"\n",
"---\n",
"\n",
"**Write the expression for the sensitivity function $g$ with your parameter values (use [eq4]())**\n",
"**Write the expression for the sensitivity function $g$ with your parameter values (use {eq}`eq2_4`)**\n",
"\n",
"<details>\n",
" <summary>Show Answer</summary>\n",
Expand Down Expand Up @@ -380,29 +380,29 @@
"\n",
"### Differential equation\n",
"\n",
"As mentioned in [eq 6](), the model equation will be solved in terms of the logarithm of $Q$. By introducing a variable $x$,\n",
"As mentioned in {eq}`eq2_6`, the model equation will be solved in terms of the logarithm of $Q$. By introducing a variable $x$,\n",
"\n",
"$$\n",
"x = \\ln(Q) \\qquad \\qquad \\qquad (9)\n",
"$$\n",
"x = \\ln(Q)\n",
"$$(eq2_9)\n",
"\n",
"you can rewrite [eq 6]() to\n",
"you can rewrite {eq}`eq2_6` to\n",
"\n",
"$$\n",
"\\frac{\\mathrm{d}x}{\\mathrm{d}t} = a \\cdot (e^ x)^ {b-1} \\cdot \\left(\\frac{P-ET}{e^ x}-1\\right) \\qquad \\qquad \\qquad (10)\n",
"$$\n",
"\\frac{\\mathrm{d}x}{\\mathrm{d}t} = a \\cdot (e^ x)^ {b-1} \\cdot \\left(\\frac{P-ET}{e^ x}-1\\right)\n",
"$$(eq2_10)\n",
"\n",
"Write a function (with name ``diff_eq``) in the script which computes $\\frac{\\mathrm{d}x}{\\mathrm{d}t}$ (so which returns the right-hand side of this equation) given a certain $x$, $P$, $ET$, $a$ and $b$. Later on, you will use this function every time step, so to make clear that you want one value of $P$, $ET$ and $x$ and not the whole vector, give the arguments the names `Pi`, `ETi` and `xi` (and `a` and `b`). Note that in R, the function `log` computes the natural logarithm and `exp` the exponent.\n",
"\n",
"### Runge-Kutta integration scheme\n",
"\n",
"There are many ways to solve eq. (10) numerically. The most straightforward way is Euler forward, in which a new value of a variable ($x_{i+1}$) is computed from the old value ($x_i$) by \n",
"There are many ways to solve {eq}`eq2_10` numerically. The most straightforward way is Euler forward, in which a new value of a variable ($x_{i+1}$) is computed from the old value ($x_i$) by \n",
"\n",
"$$\n",
"x_{i+1} = x_i + a \\cdot (e^{x_i})^ {b-1} \\cdot \\left(\\frac{P_{i+1}-ET_{i+1}}{e^{x_i}}-1\\right) \\Delta t\\ \\ . \\qquad \\qquad \\qquad (11)\n",
"$$\n",
"x_{i+1} = x_i + a \\cdot (e^{x_i})^ {b-1} \\cdot \\left(\\frac{P_{i+1}-ET_{i+1}}{e^{x_i}}-1\\right) \\Delta t\\ \\ .\n",
"$$(eq2_11)\n",
"\n",
"Because the Euler forward method is not always stable, you will use the Runge-Kutta method instead (you can also try the Euler forward method if you want). In the Runge-Kutta integration scheme, you solve this differential equation in steps. When eq. (10) is abbreviated to $\\frac{\\mathrm{d}x}{\\mathrm{d}t} = f(x(t))$, these steps are:\n",
"Because the Euler forward method is not always stable, you will use the Runge-Kutta method instead (you can also try the Euler forward method if you want). In the Runge-Kutta integration scheme, you solve this differential equation in steps. When {eq}`eq2_10` is abbreviated to $\\frac{\\mathrm{d}x}{\\mathrm{d}t} = f(x(t))$, these steps are:\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
Expand All @@ -419,7 +419,7 @@
"\n",
"### For-loop\n",
"\n",
"Next, make a function called \\verb!run_model! with arguments ``forc`` (a data frame with forcing data $P$ and $ET$), ``a`` and ``b``. This function consists of three parts.\n",
"Next, make a function called `run_model` with arguments ``forc`` (a data frame with forcing data $P$ and $ET$), ``a`` and ``b``. This function consists of three parts.\n",
"\n",
"1. Make an empty vector called `x`. Fill the first element of `x` using the observed \\( Q \\) at \\( t=0 \\) (this is the starting value of `x`), which you can extract automatically from the `forc` data frame.\n",
"2. Run a for-loop over all timesteps, starting with timestep number 2 (as you already have the first one). For each step, call the function `runge_kutta` and write the result in the vector `x`. In this way, all elements in the vector `x` will be filled step by step.\n",
Expand Down Expand Up @@ -553,11 +553,11 @@
"\n",
"### Final assignment\n",
"\n",
"Give an estimate of the peak discharge around 7~and 8~August~2007 using the simple dynamical system approach. For this period, $P$ and $ET$ are given, but the $Q$ data are replaced with NAs. Run the model with different parameter sets to assess the effect of parameter uncertainty on the model outcomes. You are also welcome to try different initial conditions or put noise on the observed $P$ or $ET$ to simulate measurement errors.\n",
"Give an estimate of the peak discharge around 7 and 8 August 2007 using the simple dynamical system approach. For this period, $P$ and $ET$ are given, but the $Q$ data are replaced with NAs. Run the model with different parameter sets to assess the effect of parameter uncertainty on the model outcomes. You are also welcome to try different initial conditions or put noise on the observed $P$ or $ET$ to simulate measurement errors.\n",
"\n",
"You can run the model for a longer period around the period with missing data. Make sure to start on a day when there was still discharge available, because otherwise the model does not have starting values (since they are derived from $Q_0$) and will not run. \n",
"\n",
"Cut out the discharges from 7~and 8~Aug. Make one vector of these 48~hourly values. Copy this vector to your clipboard (preprogrammed in the script) and paste it in Google Sheets before 13.00. We will discuss the results at 13:05.\n"
"Cut out the discharges from 7 and 8 Aug. Make one vector of these 48~hourly values. Copy this vector to your clipboard (preprogrammed in the script) and paste it in Google Sheets before 13.00. We will discuss the results at 13:05.\n"
]
},
{
Expand All @@ -580,6 +580,11 @@
"\n",
"5. Teuling, A.~J., Lehner, I., Kirchner, J.~W., Seneviratne, S.~I. (2010). Catchments as simple dynamical systems: Experience from a Swiss prealpine catchment. *Water Resources Research, 46*, W10502.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
Expand Down
4 changes: 3 additions & 1 deletion book/recession/recession_slides.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"48 lecture slides are given"
"[Embed PDF](../lec_slides/recession_lec.pdf)\n",
"\n",
"<iframe src=\"..\\lec_slides\\lowlands_lec.pdf\" width=\"100%\" height=\"600px\"></iframe>"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion book/topography/topography_intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"\n",
"This practical focuses on the importance of the catchment geomorphology for the catchment response to rainfall. Digital elevation models (DEMs) are relatively easily available (compared to e.g. soil maps or the location of river branches) and are often used as a first tool to characterize catchments. A detailed analysis of a digital elevation model will give a first idea of how the discharge will respond to rainfall events. \n",
"\n",
"You don't have to do all exercises, but make sure you start with the Sec.~5 at approximately 11:30, Sec.~6 at 12:00 and the final assignment at 12:30. We discuss the results at 13.05..\n"
"You don't have to do all exercises, but make sure you start with the [Sec 6.3.4](topography_practical.ipynb#rainfall-runoff-modelling) at approximately 11:30, [Sec 6.3.5](topography_practical.ipynb#topmodel) at 12:00 and the final assignment at 12:30. We discuss the results at 13.05.\n"
]
},
{
Expand Down
Loading

0 comments on commit 25704b6

Please sign in to comment.