Florida's Water Budget

The Impact of Humans & Nature on Freshwater Sources

This activity displays the water use, rainfall and water levels in Florida counties. You can use the code to change the charts and graphs below. Try to find the significance between the data.

Sources include (waterdata.usgs.gov/fl/nwis/current/?type=precip)

and (www.sjrwmd.com)


In [ ]:
# Import modules that contain functions we need
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt

In [ ]:
# Our data is a table and is defined as the word 'data'.
# 'data' is set equal to the .csv file that is read by the pandas function.
# The .csv file must be in the same disrectory as the program.
#data = pd.read_csv("Public Water Supply FL 2010.csv")

# You can also use external links to .xls, .csv, or .txt files and would import useing the same funtion but replaceing the
# file name with the webpage. For example:
data = pd.read_csv("https://gist.githubusercontent.com/GoodmanSciences/9d53d0874281a61354cc8a9a962cb926/raw/e379c22e667aa309cc02048bd2b7bb31ce540d60/Public%2520Water%2520Supply%2520FL%25202010.csv")

PART 1: Water Used by Florida Counties in 2010

This table displays the County name, its population, the puplic water supply for that county, and the total water used by that county.


In [ ]:
# displays the first few rows of the table
data.head(4)

In [ ]:
# Set variables for scatter plot
x = data.Population
y = data.WaterUsed

fig = plt.figure(figsize=(15, 6))
plt.scatter(x,y)
plt.xlim(0,3000000)
plt.ylim(0,350)
plt.title('The Relationship Between Population and How Much Water a County Consumes Each Year')
plt.xlabel('Population (individuals)')
plt.ylabel('Water Used (million gallons)')

# This actually shows the plot
plt.show()

In [ ]:
# Creates a new dataset for County

place = data.groupby("County", as_index = False).sum()

This table shows the top 10 water consuming counties, the population, the amount of the population that is connected to public water (PublicSupply), and the total water used by each county.


In [ ]:
# Orginizes by County with the highest water usage in decending order
#Only displays the top 10 highestest water consuming counties by putting .head(10)

mostwater = place.sort_values(by="WaterUsed", ascending = False).head(10)
mostwater

Most Water Consuming Counties in Florida


In [ ]:
# Displays a histogram of the top 10 water consuming counties in ascending order

mostwater.sort_values(by="WaterUsed", ascending=True).plot(x="County", y="WaterUsed", kind="barh", title="Top 10 Water Consuming Counties", legend=False);

Try to change the histogram so that it displays the County and the Population Total. (Right now it is displaying County and Water Use Total)

PART 2: Rainfall Additions to the Water Supply


In [ ]:
# Imports more csv files locally
#feb = pd.read_csv("Feb2005_FL_rainfall.csv")
#july = pd.read_csv("July2005_FL_rainfall.csv")

# Imports more csv files from the web
july = pd.read_csv("https://gist.githubusercontent.com/GoodmanSciences/354fa30fb1e506c055621b893b26ebe8/raw/523e483ae4534c9432f91e5d5b7f9fb0356e95e1/Rainfall%2520FL%2520Jul2005.csv")
feb = pd.read_csv("https://gist.githubusercontent.com/GoodmanSciences/7088ff6b7b8e915a87ee987f3b767641/raw/a76a0dd975f95e6c0c5e6ee810e6f6e66faeca9b/Rainfall%2520FL%2520Feb2005.csv")

Rainfall in February 2005 (Inches)


In [ ]:
feb.head()

In [ ]:
# Plots rainfall form ascending order
feb.sort_values(by="Monthly Total", ascending=True).plot(x="County", y="Monthly Total", kind="barh", title="Rainfall in February (Inches)", legend=False);

Try to change the histogram to display the data in decending order.

Rainfall in July 2005 (Inches)


In [ ]:
july.head()

In [ ]:
july.sort_values(by="Monthly Total", ascending=True).plot(x="County", y="Monthly Total", kind="barh", title="Rainfall in July (Inches)", legend=False);

In [ ]:
from IPython.display import Image
from IPython.core.display import HTML 
Image(url= 'https://preview.ibb.co/g7Z6sa/Average_Monthly_Water_Consumption.png')

In [ ]:
Image(url= 'https://floridamaps.files.wordpress.com/2015/03/florida-counties.jpg')

#Double-click to make this image GINORMOUS

PART 3: Monitoring Lake Apopka a Freshwater Source for Agriculture


In [ ]:
# Imports another csv file locally
#level = pd.read_csv("Lake Apopka Waterlevel 2005.csv")

# Imports another csv file from the web
level = pd.read_csv("https://gist.githubusercontent.com/GoodmanSciences/e63b6cb68cd6ef5235dc8c113ea9995a/raw/39139535f7ef05057ecce1126ea336ca7bcfb879/Lake%2520Apopka%2520Waterlevel%25202005.csv")

In [ ]:
# Sets Date as index
lev2 = level.set_index("Date")

Water Level in February


In [ ]:
# Displays only Feb 1st through the 28th
lev2.loc["2/1/2005":"2/28/2005", :]

Water Level in July


In [ ]:
# Displays only July 1st through the 7th
lev2.loc["7/1/2005":"7/7/2005", :]

In [ ]:
# Plot of all values in level dataset
level.plot('Date', 'Water Level')

In [ ]:
Image(url= 'http://www.floridacountiesmap.com/graphics/orange.gif')