{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Water Survey of Canada Usage" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This notebook demonstrates methods for accessing and processing data extracted from the HYDAT database. \n", "\n", "\n", "### Table of Contents\n", "\n", "* [Reading Cached Data](#data): Reading the cached data sets.\n", "* [Mapping WSC Stations](#mapping): Produce a map of WSC monitoring stations.\n", "* [Viewing Station Data](#station): Extract station data from `WSC_STATIONS.csv`\n", "* [Plotting Level Data](#plottinglevels): Example of plotting lake level data from `WSC_LEVELS.csv`.\n", "* [Plotting Flow Data](#plottingflows): Example of plotting stream flow data from `WSC_FLOWS.csv`.\n", "* [Example: Comparing Levels on Rainy and Namakan Lakes](#lakelevels): A comparison of historical levels on Rainy and Namakan lakes.\n", "* [Example: What was the highest water events on Rainy Lake?](#highwater): A history of high water events on Rainy Lake.\n", "* [Example: Distribution of Inflows on Rainy River](#rainyriver): Distribution of estimated historical inflows on Rainy River, comparing 1970-1999 to 2000-2014.\n", "* [Flow-Frequency for State-of-Nature Streams in the Rainy River Watershed](#streams): Flow-frequency behavior for unencumbered streams in the Rainy River Watershed, comparing 1970-1999 to 2000-2014.\n", "* [Annual flows on Rainy River](#flowtrends): Trends in annual flow on Rainy River.\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "## Initialization" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# Display graphics inline with the notebook\n", "%matplotlib inline\n", "\n", "# Standard Python modules\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import pandas as pd\n", "\n", "# Modules to display images and data tables\n", "from IPython.core.display import display\n", "from IPython.core.display import Image\n", "\n", "# Module to request http data using Google maps api\n", "import requests\n", "\n", "# Module to manipulate dates for historical comparisons\n", "import datetime\n", "\n", "import seaborn as sns\n", "sns.set_context('talk')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Read Cached Data Files" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "STATION_NUMBER\n", "05PA001 KETTLE RIVER ABOVE KETTLE FALLS\n", "05PA003 NAMAKAN LAKE ABOVE KETTLE FALLS DAM\n", "05PA005 NORTHERN LIGHT LAKE AT OUTLET\n", "05PA006 NAMAKAN RIVER AT OUTLET OF LAC LA CROIX\n", "05PA007 CROOKED LAKE NEAR CURTAIN FALLS\n", "05PA010 FRENCH LAKE NEAR ATIKOKAN\n", "05PA011 LAC LA CROIX AT CAMPBELL'S CAMP\n", "05PA012 BASSWOOD RIVER NEAR WINTON\n", "05PA013 NAMAKAN LAKE AT SQUIRREL ISLAND\n", "05PB001 SEINE RIVER NEAR LA SEINE\n", "05PB002 LITTLE TURTLE LAKE NEAR MINE CENTRE\n", "05PB003 MANITOU RIVER ABOVE DEVIL'S CASCADE\n", "05PB004 FOOTPRINT RIVER AT RAINY LAKE FALLS\n", "05PB007 RAINY LAKE NEAR FORT FRANCES\n", "05PB009 SEINE RIVER AT STURGEON FALLS GENERATING STATION\n", "05PB012 LAC DES MILLE LACS ABOVE OUTLET DAM\n", "05PB014 TURTLE RIVER NEAR MINE CENTRE\n", "05PB015 PIPESTONE RIVER ABOVE RAINY LAKE\n", "05PB018 ATIKOKAN RIVER AT ATIKOKAN\n", "05PB019 NORTHEAST TRIBUTARY TO DASHWA LAKE NEAR ATIKOKAN\n", "05PB020 EASTERN TRIBUTARY TO DASHWA LAKE NEAR ATIKOKAN\n", "05PB021 EYE RIVER NEAR HARDTACK LAKE NORTH OF ATIKOKAN\n", "05PB022 EYE RIVER NEAR COULSON LAKE NORTH OF ATIKOKAN\n", "05PB023 RAINY LAKE AT NORTHWEST BAY\n", "05PB024 RAINY LAKE NEAR BEAR PASS\n", "05PB025 RAINY LAKE AT STOKES BAY\n", "05PC009 LA VALLEE RIVER AT LA VALLEE\n", "05PC010 STURGEON RIVER NEAR BARWICK\n", "05PC016 LA VALLEE RIVER NEAR DEVLIN\n", "05PC018 RAINY RIVER AT MANITOU RAPIDS\n", "05PC019 RAINY RIVER AT FORT FRANCES\n", "05PC022 LA VALLEE RIVER NEAR BURRISS\n", "05PC024 RAINY RIVER AT PITHERS POINT SITE NO.1\n", "05PC025 RAINY RIVER AT PITHERS POINT SITE NO.2\n", "Name: STATION_NAME, dtype: object" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "WSC_STATIONS = pd.read_pickle('../data/WSC_STATIONS')\n", "WSC_LEVELS = pd.read_pickle('../data/WSC_LEVELS')\n", "WSC_FLOWS = pd.read_pickle('../data/WSC_FLOWS')\n", "\n", "display(WSC_STATIONS['STATION_NAME'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "## Mapping WSC Stations in the Rainy River Watershed\n", "\n", "The following cell creates a pandas dataframe of monitoring stations from the STATIONS.csv table extracted from the HYDAT database. The extaction searches for all stations with a specified region bounded by latitude and longitudes.\n", "\n", "For reference, this is a map of the [Rainy River drainage](http://www.ijc.org/files/tinymce/uploaded/rl_basinmap.pdf) basin available from the International Joint Commission. \n", "\n", "
