openair includes the function importMeta to provide information on UK air pollution monitoring sites. There are currently four networks that openair has access to:
The Defra Automatic Urban and Rural Network (AURN)
The Scottish Air Quality Network (SAQN)
The Welsh Air Quality Network (WAQN)
Network(s) operated by King’s College London (KCL)
These functions are described in more detail here.
The importMeta function is the first place to look to discover what sites exist, site type (e.g. traffic, background, rural) and latitude and longitude.
# first load openairlibrary(openair)aurn <-importMeta(source ="aurn")head(aurn)
# A tibble: 6 × 6
source site code latitude longitude site_type
<chr> <chr> <chr> <dbl> <dbl> <chr>
1 aurn Aberdeen ABD 57.2 -2.09 Urban Backgrou…
2 aurn Aberdeen Erroll Park ABD9 57.2 -2.09 Urban Backgrou…
3 aurn Aberdeen Union Street Roadside ABD7 57.1 -2.11 Urban Traffic
4 aurn Aberdeen Wellington Road ABD8 57.1 -2.09 Urban Traffic
5 aurn Armagh Roadside ARM6 54.4 -6.65 Urban Traffic
6 aurn Aston Hill AH 52.5 -3.03 Rural Backgrou…
Sometimes it is necessary to have more information on the sites such as when they started (or stopped) measuring, the pollutants measured and the regions in which they exist. Additional site information can be obtained using the option all = TRUE. In the example below, we will select sites that measure NO2 at traffic locations.
Since openair started there have been huge developments with R and optional packages. These developments have made it much easier to manipulate and plot data e.g. with ggplot2 and the likes of dplyr. There is also now much more focus on interactive plotting, which is very useful in the context of considering air pollution sites.
In the example below the unique sites are selected from aurn_detailed because the site repeats the number of pollutants that are measured. Information is also collected for the map popups and then the map is plotted.
library(leaflet)aurn_unique <-distinct(aurn_detailed, site, .keep_all =TRUE)# information for map markerscontent <-paste(paste( aurn_unique$site,paste("Code:", aurn_unique$code),paste("Start:", aurn_unique$date_started),paste("End:", aurn_unique$date_ended),paste("Site Type:", aurn_unique$site_type),sep ="<br/>" ))
Warning: Unknown or uninitialised column: `date_started`.
Warning: Unknown or uninitialised column: `date_ended`.
The information above should help to describe the air quality data that is easily available through openair. Access to the data is possible through a family of functions that all tend to work in a similar way. Only two pieces of information are required: the site code(s) and the year(s) of interest.
So, to import data for the industrial Port Talbot Margam site (close to a steelworks) with the site code “PT4” for 2015 to 2018, we can:
margam <-importWAQN(site ="pt4", year =2015:2018)
This data also includes estimates of wind speed and direction (ws and wd) from the WRF model, so we can easily plot the distribution of concentrations by wind direction. This plot indicates that the highest PM10 concentrations are from the south-west i.e. the steelworks direction. A better indication of important steelworks combustion sources can be seen by plotting SO2.