{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Rainy Lake Water Levels" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The purpose of this notebook is to create a data series for the water level on Rainy Lake. The data series is written to a file `RL.pkl` that can be read into other notebooks using `RL = pd.read_pickle('/data/RL.pkl')`.\n", "\n", "The data series is constructed using data from stations 05PB007 and 05PB024 from the Water Survey of Canada. The data from the two stations are reconciled and combined to form a unique data series." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Read Data from Water Survey of Canada" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The Water Survey of Canada currently maintains two stations on Rainy Lake recording lake levels. Station 05PB007, located near Fort Frances, has been in place since 1911. The other, near Bear Pass, has been in operation since 1988. \n", "\n", "The data set is imported into the workspace by running the Water Survey of Canada notebook." ] }, { "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", "import os\n", "import datetime\n", "\n", "import seaborn as sns\n", "sns.set_context('talk')\n", "\n", "# Modules to display images and data tables\n", "from IPython.display import Image\n", "from IPython.core.display import display\n", "import requests\n", "\n", "WSC_STATIONS = pd.read_pickle('../data/WSC_STATIONS')\n", "WSC_LEVELS = pd.read_pickle('../data/WSC_LEVELS')\n", "\n", "def mapWSC(stationList):\n", " # returns a .png map image\n", " S = WSC_STATIONS.ix[stationList,['STATION_NAME','LATITUDE','LONGITUDE']]\n", " locs = [\"{0},{1}\".format(S.ix[s,'LATITUDE'], S.ix[s,'LONGITUDE']) \\\n", " for s in S.index]\n", " google_maps_url = \\\n", " \"https://maps.googleapis.com/maps/api/staticmap?\" + \\\n", " \"size=640x320\" + \\\n", " \"&maptype=terrain\" + \\\n", " \"&markers=color:red%7Csize:mid%7C\" + \"|\".join(locs)\n", " display(S)\n", " return Image(requests.get(google_maps_url).content)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | STATION_NAME | \n", "LATITUDE | \n", "LONGITUDE | \n", "
---|---|---|---|
STATION_NUMBER | \n", "\n", " | \n", " | \n", " |
05PB007 | \n", "RAINY LAKE NEAR FORT FRANCES | \n", "48.64912 | \n", "-93.32068 | \n", "
05PB024 | \n", "RAINY LAKE NEAR BEAR PASS | \n", "48.70058 | \n", "-92.95800 | \n", "