Most of my own atmospheric chemistry research as a PhD student at MIT is based in Delhi. Thus, for this tutorial, we will take a deeper look at the air quality data made available to us through OpenAQ. We will begin by figuring out exactly what data is available to us, and then further examine the most relevant and up-to-date sources. We will take a look at longer trends for some pollutants where possible.
In [1]:
import pandas as pd
import seaborn as sns
import matplotlib as mpl
import matplotlib.pyplot as plt
import openaq
import warnings
warnings.simplefilter('ignore')
%matplotlib inline
# Set major seaborn asthetics
sns.set("notebook", style='ticks', font_scale=1.0)
# Increase the quality of inline plots
mpl.rcParams['figure.dpi']= 500
In [2]:
api = openaq.OpenAQ()
locations = api.locations(city='Delhi', df=True)
locations.location
Out[2]:
Let's go ahead and filter our results to only grab locations that have been updated in 2017 and have at least 100 data points.
In [3]:
locations = locations.query("count > 100").query("lastUpdated >= '2017-03-01'")
locations.location
Out[3]:
Now that we have several up-to-date locations in Delhi we can use, let's see what parameters we have to play with!
In [4]:
params = []
for i, r in locations.iterrows():
[params.append(x) for x in r.parameters if x not in params]
params
Out[4]:
Great. Now we have a list of parameters that we can evaluate.
The rest of this tutorial will be finished in the future when I have away from writing manuscripts (unless someone wants to take a stab at it and send a pull request!)...