Back Home

Earthquakes in Oklahoma

USGS Data

Email: LouMoura@gmail.com

Summary

Importing and using the data from the USGS, it shows the daily earthquakes in Oklahoma, a region where it wasn't supposed to be very active. Not sure if also increasing is the magnitude of the earthquakes.

Last night: 5.0 mag. http://edition.cnn.com/2016/11/07/us/oklahoma-earthquake/

In [1]:
import pandas as pd
import folium
from matplotlib.colors import Normalize, rgb2hex
import matplotlib.cm as cm
In [2]:
data = pd.read_csv('http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.csv')
norm = Normalize(data['mag'].min(), data['mag'].max())

map = folium.Map(location=[35.4338, -97.5037], zoom_start=6)
for eq in data.iterrows():
    color = rgb2hex(cm.OrRd(norm(float(eq[1]['mag']))))
    map.circle_marker([eq[1]['latitude'], eq[1]['longitude']], 
                    popup=eq[1]['place'], 
                    radius=20000*float(eq[1]['mag']),
                    line_color=color,
                    fill_color=color)
folium.LatLngPopup().add_to(map)    
map.save('images/earthquake.html')

map       
/Users/louiemoura/anaconda/lib/python3.5/site-packages/ipykernel/__main__.py:11: FutureWarning: circle_marker is deprecated. Use add_children(CircleMarker) instead
Out[2]:
In [ ]: