The openair book

A Guide to the Analysis of Air Pollution Data


David C Carslaw

Jack Davison


April 8, 2024


Hello and welcome

Cover image

This document has been a long time coming. The openair project started with funding from the UK Natural Environment Research Council (NERC) over 10 years ago. The main aim was to fill a perceived gap in that there was a lack of a dedicated set of easily accessible, open source tools for analysing air quality data. At that time R was becoming increasingly popular but far, far less than it is today.

The book is split into broad sections that cover common aspects of air quality data analysis.

  • Data Import Mostly focused on the easy access of UK air quality data across national and regional networks and accessing global meteorological data.

  • Directional Analysis Many common functions such as wind and pollution roses, bivariate polar plots and back trajectories.

  • Time Series and Trends Various ways of considering changes in time and flexible methods for trend assessment.

  • Model Evaluation Functions such as Taylor Diagrams, common model evaluation statistics and conditional quantile plots.

  • Interactive Maps Considers effective ways of viewing UK air quality networks and plotting directional analyses on interactive plots; particularly useful for source characterisation.

  • Utility functions various functions to flexibly carry out time-averaging, correlation analysis and other common tasks of relevance to air pollution.

openair does not of course cover every conceivable analysis that users might be interested in, but a selection of flexible methods that should have wide appeal. However, by using R as the basis of development, users can greatly extend the types of analysis in many powerful and innovative ways.

openair is a product of the time it was started and used the highly capable lattice package for plotting. This was a time before ggplot2 and the ‘tidyverse’. Nevertheless, the package is used extensively around the world (see downloads here) and if anything, growing in popularity and use. The original aims of the project have been met in providing tools for academia, the private and public sectors — all of which continue to use the software.

At some point there will need to be a transition to ggplot2; in particular to capitalise on the many extensions available and which openair can benefit from.

The reason for writing this book (or manual) in this form i.e. a website rather than a pdf or Word document is convenience for all involved. For me it makes it much easier to keep the information up to date and ensure that the information is reproducible. For the reader it is something that can easily be read and navigated in a browser. Where code is involved — as it is heavily in this book — it is very easy to use the copy icon at the top right of each code block to make it easy to copy into R. Finally, it is increasingly the case that information can be plotted interactively, which is not something that can easily be done in a pdf or Word document.

To cite openair please use:

Carslaw, D. C., and K. Ropkins. 2012. “openair — An R package for air quality data analysis.” Environmental Modelling & Software 27–28 (0): 52–61.

This document was produced using R version 4.3.0 and openair version