{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook implements an dynamic graph showing the relationship between river discharge and river height for different levels of roughness, using Manning's equation.\n",
"\n",
"Author: Dr Andy Evans \n",
"Licence: Academic Free License 3.0"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It uses a variety of Python libraries, including Jupyter Widgets for the scrollbars."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEZCAYAAACU3p4jAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xe4FOXZx/Hvzw4qBHvvJZpYYu8eezfGrrE34musiUaN\nBUuMGmNJ4pvErlgwEn0VYweOKEaxoaDEhj2KIlhB6v3+8cyB5XDKnrJntvw+13Wuszs7O3PPlnuf\nueeZZxQRmJlZ9Zsj7wDMzKxrOOGbmdUIJ3wzsxrhhG9mViOc8M3MaoQTvplZjXDCb0TSXyX9tgPP\nP1zSU50ZU6WRtIWkUV20rvMl9W3nc8+SdF2p15M9f2tJH7b3+eWmo9+TatKWz1HeairhS3pP0gRJ\nX0kaJ+lpSb0lqWGeiDg+In7XwVXV9MkNEfF0RKzRlats15Mifh8Rx3XGeiS9K2nb9j6/LSTdImm6\npD0aTb8qm35YZ6ynJZ30PQFA0vR2POd8SZMlfZ39fSNpXGfE08p6Z/vhbsfnKDc1lfBJX7jdIqIn\nsDxwKfAb4MZco2qGpDnzjqGtShlzJb4eJRLAG8CMxJ69NvsBb+cVVA76RUSP7G/BiFioC9YpKrhB\nV2sJH9IbRkR8ExEPAgcAh0taE0DSzZIuzG4vLGmApPGSvpD05IyFSMtI+qekzyR9LulPheuQ9Ids\nL+IdSTsXPHCEpNezVsnbko4reGxrSR9KOkPSJ8BN2fQzJP1X0keSjs5acStlj80j6QpJ70v6RNL/\nSpp3to1O841v2M5s2iLZHs8iLW1riy9mEzEX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H1mtWyAnfzKxGuIZvZlYjnPDNzGqEE76ZWY1wwjczqxFO+GZmNcIJ38ysRvw/\nQDThxmmRY8IAAAAASUVORK5CYII=\n",
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
""
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot\n",
"import numpy\n",
"import math\n",
"import ipywidgets \n",
"\n",
"\n",
"def mannings (slope = 10 ,n_roughness = 10, width = 10, bank_angle = 10) :\n",
" \"\"\"\n",
" Generates a Manning plot.\n",
" All values in meters and degrees, save n_roughness, which is dimensionless.\n",
" \"\"\"\n",
" \n",
" # Depth data\n",
" d1 = numpy.asarray([0.0,1.0,2.0,3.0,4.0,5.0,6.0]);\n",
"\n",
" # Starting dischange data\n",
" d2 = numpy.asarray([0.0,0.0,0.0,0.0,0.0,0.0,0.0]);\n",
"\n",
" # For each depth, calculate the discharge\n",
" for i in range(0,len(d1)) :\n",
" radians = bank_angle * (math.pi / 180);\n",
" ob = d1[i] * math.tan(radians);\n",
" tri = ((0.5 * ob) * d1[i]);\n",
" area = (width * d1[i]) + (2 * tri);\n",
" hyp = (d1[i] / math.cos(radians));\n",
" wetted = (2 * hyp) + width;\n",
" r = area / wetted;\n",
" d2[i] = ((((math.pow(r,(2.0/3.0)))*(math.pow(slope,(1.0/2.0))))/n_roughness)*(area)); \n",
"\n",
" # Plot the data\n",
" fig = matplotlib.pyplot.figure()\n",
" subfig = fig.add_subplot(111)\n",
"\n",
" line = subfig.plot(d1, d2)\n",
" subfig.set_xlim(numpy.min(d1), numpy.max(d1) * 1.1)\n",
" subfig.set_ylim(numpy.min(d2), numpy.max(d2) * 1.1)\n",
"\n",
" subfig.set_title(\"Discharge vs. river height by Manning's Equation\")\n",
" subfig.set_xlabel(\"Height (m)\")\n",
" subfig.set_ylabel(\"Discharge (Q)\")\n",
"\n",
" matplotlib.pyplot.show()\n",
" # End of function\n",
"\n",
"# Display scrollbars. These rerun the mannings function.\n",
"ipywidgets.widgets.interact(mannings, \n",
" s = ipywidgets.widgets.IntSlider(min=1,max=30,step=1,value=10), \n",
" n = ipywidgets.widgets.IntSlider(min=1,max=30,step=1,value=10), \n",
" w = ipywidgets.widgets.IntSlider(min=1,max=30,step=1,value=10), \n",
" a = ipywidgets.widgets.IntSlider(min=1,max=30,step=1,value=10))\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.5.4"
}
},
"nbformat": 4,
"nbformat_minor": 0
}