Creating reports on Bath Weather and Air Quality using R and the OpenAir package
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
create-weather-data.R
create-wind-data.R
generate-weather-plots.R
londonRoad.Rmd
londonRoadReport.R

README.md

Air Quality Analytics

Created at the BathHacked Air Quality hack day, this project aims to answer two questions:

  1. Can we provide Bath citizens with more insight into the air quality for Bath?
  2. Can we provide the local council with new ways to generate meaningful visualisations and summary reports?

Background

This project explores the weather and air quality data available for Bath. Air quality is an important topic as it can have both short and long term effects on people's health. Access to information, guidance and data on air quality can be important for people with health problems, health professionals, and citizens looking to be more environmentally friendly.

However air quality is a complex topic. There are a number of different types of pollutants and complex analysis is often required to bring some meaning to the data. The DEFRA Air Quality website provides lots of useful information and defines a standard Air Quality Index that can be used to provide clear guidance to citizens.

At a local level, B&NES provide an overview of air quality analysis from a local perspective. This includes descriptions of the key pollutants, how air quality is monitored, and a summary of local trends.

While this is useful information, it is likely that there are other ways to present the data that can help make this information more accessible.

Data Sources

The code in this project draws on several sources:

Application Overview

The scripts are based on R and use the OpenAir package for data analysis. All development was done in RStudio.

Knitr is used for generating dynamic reports as static HTML. These documents are then published to github pages hosted in this project.

Generating a Report

The initial report uses data from a site on London Road. This report can be generated entirely from the openair package which provides a function for importing data directly from the DEFRA AURN data archive.

The report accepts three parameters: the path to the directory where the output should be generated and the start and end year for the report. The AURN archive contains data from 1997 (part year) through to 2013.

Example:

Rscript londonRoadReport.R /path/to/directory/ 2010 2013

The additional R scripts provide support for preparing other data for analysis with OpenAir and some test plots. You will need to manually download copies of the datasets from Socrata. The historical data should be saved as historical-air-quality.csv and the weather data as weather.csv:

  • create-wind-data.R -- extract wind measurements from the weather data, converting it into a data frame suitable for use with openair
  • create-weather-data.R -- as above but includes measurements for precipation, etc.
  • generate-weather-plots.R -- generate some plots from the data file generated from the above script. See links below for the example output.

Example Reports

There are also some example charts showing the weather conditions from an amateur weather station and comparisons of a wind rose from a local station and the wind data from the AURN site.

Licence

The code and supporting documentation in this project is placed into the public domain using the CC0 waiver.

The example report contains data published under the Open Government Licence.