Working with air quality and meteorological data Exercises (Part-4)

[This article was first published on R-exercises, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Atmospheric air pollution is one of the most important environmental concerns in many countries around the world, and it is strongly affected by meteorological conditions. Accordingly, in this set of exercises we use openair package to work and analyze air quality and meteorological data. This packages provides tools to directly import data from air quality measurement network across UK, as well as tools to analyse and producing reports.

In the previous exercises set we used data from MY1 station to see how to import data and extract basic statistical information from data. Then we practiced using functions that are available in openair package to analyze and visualize data. In this exercise set we will go through more advance functions that are very useful in air quality data analysis.

Back trajectories are very useful in air pollution analysis and can provide important information on air mass origins. Back-trajectories show the path of air masses traveled over specific time periods and can be used to identify sources of pollutants. However, calculating and analysis of back-trajectory data is a time consuming process. Therefore, to overcome some of these issues and expand the possibilities for data analysis, openair makes several functions available to access and analyse pre-calculated back trajectories. In this exercise set will go through these functions.

Answers to the exercises are available here.

For other parts of this exercise set follow the tag openair

Please load the package openair before starting the exercises.

Exercise 1
In the first exercise we will use importTraj function to import precalculated back-trjactories which will be also used in the next exercises. Use importTraj to import pre-calculated back-trajectories for London and for the year 2011. Save the results in a dataframe named “traj”.

Exercise 2
In this exercise will use trajPlot function to plot trajectory line to visually see how air-masses has travels before arriving to the receptor point.

Use trajPlot function to plot trajectory lines for the traj dataframe obtained in the previous exercise. Here, only use trajectories for the period of 10-16 January.

Exercise 3
There are also a few other ways of representing the data shown in For example we can plot the trajectories for each day.

Use trajPlot function to plot the same trajectory lines as in the previous exercise but separate the trajectories by day.

Exercise 4
One of the most useful approaches is to link the back trajectories with the concentrations of a pollutant.

In this exercise first import data for North Kensington using importAURN function. And then use merge function to merge the pollutant data with back-trajectories into single dataframe.

Now, use trajPlot function to plot trajectories along with pm10 level asscociated with each trajectories.

You can use Air Quality Data and weather patterns in combination with spatial data visualization, Learn more about spatial data in the online course
[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 5
Another useful analysis is to identify the contribution of high concentration back trajectories. In other words, to identify the potential of sources contributing to high pollutant concentration in the
area of interest. This can be done by trajrajLevel. In this function we can use a number of statistics option such as frequency and difference. However another statistical method that can be applied is potential source contribution function (PSCF) method which is widely use in air mass trajectory analysis to identify potential sources or hotspots for pollution.

Use trajrajLevel function to plot and identify potential sources for high pm2.5 concentration in London in 2011.

To leave a comment for the author, please follow the link and comment on their blog: R-exercises. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)