.. _delhi_tutorial:

Evaluating Delhi's AQ Using OpenAQ

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 [ ]:
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

Choosing Locations

First, let's figure out which locations we should use for our analysis. Let's grab all locations from Delhi for all parametrs:


In [ ]:
api = openaq.OpenAQ()

locations = api.locations(city='Delhi', df=True)

locations.location

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 [ ]:
locations = locations.query("count > 100").query("lastUpdated >= '2017-03-01'")

locations.location

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 [ ]:
params = []

for i, r in locations.iterrows():
    [params.append(x) for x in r.parameters if x not in params]
    
params

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!)...