4/20/2017298.6k
mike.s.smith@digitalglobe.com
Public

earthquake_daily_US

USGS data used to map United States earthquakes for 1 day.

earthquakedailyUSA

DigitalGlobe (Required Remote Kernel)
Some of the data for this notebook was provided by the DigitalGlobe remote kernel. You will need access to this remote kernel to be able to make full use of this notebook.

%%bash
/anaconda/envs/juno/bin/pip install folium
Collecting folium
  Downloading folium-0.3.0-py2-none-any.whl (71kB)
Requirement already satisfied: Jinja2 in /anaconda/envs/juno/lib/python2.7/site-packages (from folium)
Requirement already satisfied: six in /anaconda/envs/juno/lib/python2.7/site-packages (from folium)
Collecting branca (from folium)
  Downloading branca-0.2.0-py2-none-any.whl
Requirement already satisfied: MarkupSafe>=0.23 in /anaconda/envs/juno/lib/python2.7/site-packages (from Jinja2->folium)
Installing collected packages: branca, folium
Successfully installed branca-0.2.0 folium-0.3.0
import pandas as pd
import folium
from matplotlib.colors import Normalize, rgb2hex
import matplotlib.cm as cm
data = pd.read_csv('http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.csv')
print 'Number of earthquakes (today):',len(data)
norm = Normalize(data['mag'].min(), data['mag'].max())

map = folium.Map(location=[48, -102], zoom_start=3)
for eq in data.iterrows():
    color = rgb2hex(cm.OrRd(norm(float(eq[1]['mag']))))
    folium.CircleMarker([eq[1]['latitude'], eq[1]['longitude']],
                      popup=eq[1]['place'],
                      radius=20,
                      color=color,
                      fill_color=color,
                       ).add_to(map)
map
AA 221