Atmospheric air pollution is one of the most important environmental concerns in many countries around the world; it is strongly affected by meteorological conditions. In this set of exercises, we will use the
openair
package to work and analyze air quality and meteorological data. This package provides tools to directly import data from air quality measurement networks across the UK, as well as tools to analyze and produce reports.
In the previous exercise set, we practiced some advanced and useful functions in the openair
package to analyze and visualize air back-trajectories. In this exercise, first, we will practice another useful function in openair
to analyze air pollution data. Then we will use openair,
along with some other geospatial packages, to spatially analyze air pollution and meteorological data.
Answers to the exercises are available here.
For other parts of this exercise set, follow the tag openair.
For this exercise set beside openair
you will need to install and load the following packages
install.packages('ggplot2')
library(ggplot2)
install.packages('plyr')
library(plyr)
install.packages('ggmap')
library(ggmap)
Exercise 1
In this exercise, we will use calendarPlot
to visualize air quality and meteorological data. This function overlays data with a calendar.
Use calendarPlot
to visualize O3 and PM10 concentration from my1 data, which was used in the previous exercise sets and shows the concentration by colors.
Exercise 2
It is also possible with calendarPlot
to highlight days in which concentration is higher than a specified limit.
Use calendarPlot
to visualize O3 concentration and highlight those days with O3 >= 80 ppb
Exercise 3
Another useful ability of calendarPlot
is to annotate a plot with daily mean wind angle.
Use calendarPlot
to visualize PM10 data and annotate daily mean wind angle data.
[Intermediate] Spatial Data Analysis with R, QGIS & More. this course you will learn how to:
- Work with Spatial data and maps
- Learn about different tools to develop spatial data next to R
- And much more
Exercise 4
In this exercise, we are going to practice more advanced and interesting geospatial air quality analysis. It would be very useful to compare the concentration of pollutants at different stations at the same time; it would also give a lot of information. For this practice, first, we should download hourly o3 concentration sample data for 2006 from 16 stations across the UK. Also, we need to download data for locations of each station. This data is placed into the openair
server. To download data, run the following function using the openair
package:
load(url("http://www.erg.kcl.ac.uk/downloads/Policy_Reports/AQdata/o3Measurements.RData"))
load(url("http://www.erg.kcl.ac.uk/downloads/Policy_Reports/AQdata/siteDetails.RData"))
After importing data, first, calculate the annual mean o3 by ddaply
function in the plyr
package. Then merge the o3 data with site details and put the result in a data frame called “annual.” Finally, overlay the annual o3 concentration data with the world map using ggplot2
and ggmap
packages.
Exercise 5
This exercise will be the same as the previous exercises, but instead of using annual mean, use maximum o3 for winter.
Thank you for your exercise and answers but This code cant import the dataset in R and kept saying “cannot open URL ‘http://www.erg.kcl.ac.uk/downloads/Policy_Reports/AQdata/o3Measurements.RData’: HTTP status was ‘401 Unauthorized’ : load(url(“http://www.erg.kcl.ac.uk/downloads/Policy_Reports/AQdata/o3Measurements.RData”))
any other method?
Thank you Professor for your time. Is there any other method to import o3Measurements because the current codes generate errors : URL ‘http://www.erg.kcl.ac.uk/downloads/Policy_Reports/AQdata/o3Measurements.RData’: HTTP status was ‘401 Unauthorized’ : load(url(“http://www.erg.kcl.ac.uk/downloads/Policy_Reports/AQdata/o3Measurements.RData”))
Thank you