{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Assignment 6: Floods\n", "\n", "*Due date: March 16*\n", "\n", "*4 pts + 2 final project points*\n", "\n", "In this assignment, we will look at flow data from the Feather River just downstream of the Oroville Dam, in order to figure out the statistical frequency of the recent high-flow event.\n", "\n", "Questions are interspersed among the \"tutorial\"-type material below. Please **submit your assignment as an html export**, and for written responses, please type them in a cell that is of type `Markdown.`" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Import numerical tools\n", "import numpy as np\n", "\n", "#Import pandas for reading in and managing data\n", "import pandas as pd\n", "\n", "# Import pyplot for plotting\n", "import matplotlib.pyplot as plt\n", "\n", "#Import seaborn (useful for plotting)\n", "import seaborn as sns\n", "\n", "# Magic function to make matplotlib inline; other style specs must come AFTER\n", "%matplotlib inline\n", "\n", "%config InlineBackend.figure_formats = {'svg',}\n", "#%config InlineBackend.figure_formats = {'png', 'retina'}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Importing data\n", "Unfortunately, the USGS does not have any data from this year available from the Feather River or its tributaries. (For this river, it only makes data available after staff hydrologists have had a chance to review it.) I was, however, able to find recent data available from a station maintained by the CA Department of Water Resources (DWR) on [this website](https://cdec.water.ca.gov/queryCSV.html). The station is the Feather River at Gridley, which is just downstream of Oroville. However, the period of record only goes back to 1984 (in contrast to some of the USGS stations with periods of record back to the early 1900s.) The [DWR data](https://drive.google.com/file/d/0BzoZUD3hISA4U0FPWHdna3pCZFU/view?usp=sharing) is downloadable as a CSV, in which the columns represent data collected on the hour over the 24 hours of the day, and the rows represent days in the period of record. Let's import it and begin to work with it. First, make sure the data file is saved to your computer." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", " | 'station' | \n", "'sensor' | \n", "year-month-day | \n", "0 | \n", "100 | \n", "200 | \n", "300 | \n", "400 | \n", "500 | \n", "600 | \n", "... | \n", "1400 | \n", "1500 | \n", "1600 | \n", "1700 | \n", "1800 | \n", "1900 | \n", "2000 | \n", "2100 | \n", "2200 | \n", "2300 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "GRL | \n", "20.0 | \n", "19840101.0 | \n", "-9998.0 | \n", "37400.0 | \n", "37100.0 | \n", "36900.0 | \n", "36800.0 | \n", "36500.0 | \n", "36100.0 | \n", "... | \n", "31700.0 | \n", "31600.0 | \n", "31400.0 | \n", "31300.0 | \n", "31300.0 | \n", "31100.0 | \n", "30900.0 | \n", "30900.0 | \n", "30800.0 | \n", "30700.0 | \n", "
1 | \n", "GRL | \n", "20.0 | \n", "19840102.0 | \n", "30600.0 | \n", "30600.0 | \n", "-9998.0 | \n", "-9998.0 | \n", "-9998.0 | \n", "30200.0 | \n", "29900.0 | \n", "... | \n", "25000.0 | \n", "24000.0 | \n", "23100.0 | \n", "22200.0 | \n", "21200.0 | \n", "20600.0 | \n", "20100.0 | \n", "19800.0 | \n", "19700.0 | \n", "19500.0 | \n", "
2 | \n", "GRL | \n", "20.0 | \n", "19840103.0 | \n", "19400.0 | \n", "19300.0 | \n", "19200.0 | \n", "19100.0 | \n", "19000.0 | \n", "18900.0 | \n", "18900.0 | \n", "... | \n", "18900.0 | \n", "18900.0 | \n", "18900.0 | \n", "18800.0 | \n", "18800.0 | \n", "18800.0 | \n", "18800.0 | \n", "18700.0 | \n", "18600.0 | \n", "18600.0 | \n", "
3 | \n", "GRL | \n", "20.0 | \n", "19840104.0 | \n", "18600.0 | \n", "18600.0 | \n", "18600.0 | \n", "18600.0 | \n", "18600.0 | \n", "18500.0 | \n", "18500.0 | \n", "... | \n", "18400.0 | \n", "18400.0 | \n", "18400.0 | \n", "18400.0 | \n", "18400.0 | \n", "18400.0 | \n", "18300.0 | \n", "18300.0 | \n", "18300.0 | \n", "18300.0 | \n", "
4 | \n", "GRL | \n", "20.0 | \n", "19840105.0 | \n", "18200.0 | \n", "18200.0 | \n", "18200.0 | \n", "18200.0 | \n", "18200.0 | \n", "18100.0 | \n", "18100.0 | \n", "... | \n", "18100.0 | \n", "18100.0 | \n", "18100.0 | \n", "18100.0 | \n", "18100.0 | \n", "18100.0 | \n", "18100.0 | \n", "18100.0 | \n", "18100.0 | \n", "-9998.0 | \n", "
5 rows × 27 columns
\n", "