{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# USGS Water Use by County in 2015" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### The [U.S. Geological Survey's National Water-Use Science Project](https://water.usgs.gov/watuse/), compiles and reports water-use data for the nation." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Water-Use reports and data are published at 5 year intervals starting in 1950. \n", "- The USGS published the most recent report [Estimated use of water in the United States in 2015](https://pubs.er.usgs.gov/publication/cir1441) in June, 2018. \n", "- Along with this report, the USGS released [Estimated Use of Water in the United States County-Level Data for 2015](https://www.sciencebase.gov/catalog/item/get/5af3311be4b0da30c1b245d8). \n", "\n", "##### We will use this dataset to get a sense for public and private drinking water-use in Vermont at the county-scale and how it compares to the rest of the Continental United States." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Load necessary libraries\n", "import sciencebasepy\n", "import pandas as pd\n", "import requests\n", "import io\n", "import zipfile\n", "import shapefile\n", "from shapely.geometry import shape\n", "import geopandas as gpd\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Access relevant data\n", "- The USGS Water Use data is posted on https://www.sciencebase.gov/catalog/\n", "- This script accesses the dataset using the [sciencebasepy](https://github.com/usgs/sciencebasepy) module." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Begin ScienceBase session\n", "sb = sciencebasepy.SbSession()\n", "\n", "# Dataset id found in ScienceBase url\n", "dataset_id = '5af3311be4b0da30c1b245d8'\n", "\n", "# This is a public item, no log in required.\n", "item_json = sb.get_item(dataset_id)\n", "\n", "# Find csv path in attached files\n", "url = [file for file in item_json['files'] if 'csv' in file['name']][0]['url']\n", "\n", "# Read csv into dataframe\n", "water_use_2015 = pd.read_csv(url, header = 1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Examine the water-use dataset" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | STATE | \n", "STATEFIPS | \n", "COUNTY | \n", "COUNTYFIPS | \n", "FIPS | \n", "YEAR | \n", "TP-TotPop | \n", "PS-GWPop | \n", "PS-SWPop | \n", "PS-TOPop | \n", "... | \n", "TO-WGWTo | \n", "TO-WSWFr | \n", "TO-WSWSa | \n", "TO-WSWTo | \n", "TO-WFrTo | \n", "TO-WSaTo | \n", "TO-Wtotl | \n", "TO-CUsFrPartial | \n", "TO-CUsSaPartial | \n", "TO-CUTotPartial | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "AL | \n", "1 | \n", "Autauga County | \n", "1 | \n", "1001 | \n", "2015 | \n", "55.347 | \n", "-- | \n", "-- | \n", "48.998 | \n", "... | \n", "10.69 | \n", "45.72 | \n", "0.0 | \n", "45.72 | \n", "56.41 | \n", "0.0 | \n", "56.41 | \n", "13.18 | \n", "0.0 | \n", "13.18 | \n", "
1 | \n", "AL | \n", "1 | \n", "Baldwin County | \n", "3 | \n", "1003 | \n", "2015 | \n", "203.709 | \n", "-- | \n", "-- | \n", "174.907 | \n", "... | \n", "73.38 | \n", "11.32 | \n", "0.0 | \n", "11.32 | \n", "84.70 | \n", "0.0 | \n", "84.70 | \n", "58.28 | \n", "0.0 | \n", "58.28 | \n", "
2 | \n", "AL | \n", "1 | \n", "Barbour County | \n", "5 | \n", "1005 | \n", "2015 | \n", "26.489 | \n", "-- | \n", "-- | \n", "24.587 | \n", "... | \n", "6.06 | \n", "2.96 | \n", "0.0 | \n", "2.96 | \n", "9.02 | \n", "0.0 | \n", "9.02 | \n", "2.96 | \n", "0.0 | \n", "2.96 | \n", "
3 | \n", "AL | \n", "1 | \n", "Bibb County | \n", "7 | \n", "1007 | \n", "2015 | \n", "22.583 | \n", "-- | \n", "-- | \n", "20.947 | \n", "... | \n", "5.67 | \n", "0.20 | \n", "0.0 | \n", "0.20 | \n", "5.87 | \n", "0.0 | \n", "5.87 | \n", "0.19 | \n", "0.0 | \n", "0.19 | \n", "
4 | \n", "AL | \n", "1 | \n", "Blount County | \n", "9 | \n", "1009 | \n", "2015 | \n", "57.673 | \n", "-- | \n", "-- | \n", "44.815 | \n", "... | \n", "4.64 | \n", "55.43 | \n", "0.0 | \n", "55.43 | \n", "60.07 | \n", "0.0 | \n", "60.07 | \n", "1.08 | \n", "0.0 | \n", "1.08 | \n", "
5 rows × 141 columns
\n", "