{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# February 2, 2017 class: Precipitation, continued" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's start off with the usual import. The Seaborn package generally makes your plots look nicer. You probably need to install it first. Open up a terminal window and type `pip install seaborn`, and your computer will do the rest! If you don't have time to do this now, your plot will still work but won't look quite as pretty." ] }, { "cell_type": "code", "execution_count": 1, "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", "#This imports the statistics of the normal distribution\n", "from scipy.stats import norm\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": [ "We're going to read in [some actual rainfall gauge data](https://drive.google.com/file/d/0BzoZUD3hISA4bE1WbFJocHpSd3c/view?usp=sharing) from Niger. The variable precip6hrly is precipitation data collected every 6 hours for the full years 1990-2012. The variable PrecipDaily is the same dataset, aggregated at the daily time interval." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Use pd.read_csv() to read in the data and store in a DataFrame\n", "fname = '/Users/lglarsen/Desktop/Laurel Google Drive/Terrestrial hydrology Spr2017/Public/precipAll.csv'\n", "df = pd.read_csv(fname)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", " | precip6hrly | \n", "precipDaily | \n", "
---|---|---|
0 | \n", "0.0 | \n", "0.0 | \n", "
1 | \n", "0.0 | \n", "0.0 | \n", "
2 | \n", "0.0 | \n", "0.0 | \n", "
3 | \n", "0.0 | \n", "0.0 | \n", "
4 | \n", "0.0 | \n", "0.0 | \n", "