EXAMPLES
openair Examples
Below are a few examples of how openair can be used to analyse air pollution data. These examples use a data set that comes with openair called `mydata’, which consists of hourly air pollution and meteorological data from 1998 to June 2005 from a roadside site in central London. The data set itself is used throughout the documentation so users become familiar with all the functions using consistent data. It also means that all the plots shown in the manual are easily reproducible – and helpful for users compiling their own data to analyse.
The first example uses a function called polar.freq, which in its simplest form is used to show wind speed-direction frequencies. The user types the following into R:
polar.freq(mydata, type = “year”)
and the plot below is produced. The different colours correspond to the number of occasions the wind was in a certain direction with a certain speed. It automatically labels the time period and chooses a scale that best represents the distribution of data. In this case it is clear that winds are dominated by those from the south-west for most years. However, 2003 stands out as having more hours where the wind was from the east.

One of the central themes in openair is the idea of conditioning. Rather than just plotting one variable against another, far more useful information can be gleaned if these relationships are also plotted against a third (conditioning) variable. In the plot above, for example, individual panels show how the relationship between wind speed and direction vary by year. However, the plots can be shown to vary in a very wide variety of ways e.g. day of the week, hour of the day, temperature, site type etc. - each offereing different insights into the character of pollutant concentrations.
In the second example we produce a bivariate polar plot. These plots can be very effective at detecting different source types. Carslaw et al. (2006) show how these plots were developed for use in source identification and characterisation. In the plot below the concentration of SO2 is shown using a colour scale. At the centre of the plot is zero wind speed, increasing as one moves towards the circumference (in this case to 21 m/s). This plot shows that for high wind speed conditions from the east, concentrations of SO2 at this location are high. The behaviour is unlike a ground-level source such as road transport where concentrations tend to decrease rapidly with increasing wind speed.
The reason wind speed is useful in this respect is to with the dispersion characteristics. It can be shown (using dispersion models for example) that maximum ground-level concentrations from a buoyant plume from chimney stack peak tend to peak for higher wind speeds. In this case, the source is most likely power stations to the east of London. We have also used such analysis to identify other source types such as aircraft NOX emissions.
Note also another feature that makes labelling of plots easy: openair recognises that ‘so2’ should be written as ‘SO2’ and formats it accordingly. This type of functionality can save time and allow users to focus on understanding the problem in hand rather than formatting plots.
polar.plot(mydata, pollutant = “so2”, main = “so2 at Marylebone Road”)

Another important example is the analysis of trends. There are many trend tests available and openair contains several. While it is useful to consider all the data available at once, often more insight is gained by splitting the data up in different ways. In the example below, the monthly trend in ozone at Marylebone Road is considered. However, several extensions are applied. First, because concentrations of ozone tend to be strongly seasonal, we choose to deseasonalise the data, which gives a better indication of monthly trends. Second, we choose to show the trends by wind sector. In the plot below it is deliberately laid out to represent the points of the compass for easy interpretation. In this case, for example, it is easy to see that positive trends in ozone are seen for northerly winds.
In the plot the red line shows the best trend estimate and the dashed line the estimated 95 % confidence interval in the trend line. The numbers at shown in the top left give the details. For example, when the wind is from the north-west there is a positive slope in ozone trend of 0.71 ppb/yr and the 95 % confidence interval is from 0.44-1.05 ppb/yr.
This and other functions run bootstrap simulations to provide more robust assessments of the trend and uncertainties in the trend. This essentially involves sampling from the original data many times to derive an estimated distribution of uncertainties. This sort of approaches is routinely available in R and is one of the many strengths of using it for data analysis.
MannKendall(mydata, pollutant = “o3”, type = “wd”, deseason = TRUE)

References
Carslaw, D.C., Beevers, S.D, Ropkins, K and M.C. Bell (2006). Detecting and quantifying aircraft and other on-airport contributions to ambient nitrogen oxides in the vicinity of a large international airport. Atmospheric Environment. 40/28 pp 5424-5434.
What next:
- Want to get a copy of openair?
- Want to get involved?
- (Want to Join the mailing group?)
openair Examples
Below are a few examples of how openair can be used to analyse air pollution data. These examples use a data set that comes with openair called `mydata’, which consists of hourly air pollution and meteorological data from 1998 to June 2005 from a roadside site in central London. The data set itself is used throughout the documentation so users become familiar with all the functions using consistent data. It also means that all the plots shown in the manual are easily reproducible – and helpful for users compiling their own data to analyse.
The first example uses a function called polar.freq, which in its simplest form is used to show wind speed-direction frequencies. The user types the following into R:
polar.freq(mydata, type = “year”)
and the plot below is produced. The different colours correspond to the number of occasions the wind was in a certain direction with a certain speed. It automatically labels the time period and chooses a scale that best represents the distribution of data. In this case it is clear that winds are dominated by those from the south-west for most years. However, 2003 stands out as having more hours where the wind was from the east.

One of the central themes in openair is the idea of conditioning. Rather than just plotting one variable against another, far more useful information can be gleaned if these relationships are also plotted against a third (conditioning) variable. In the plot above, for example, individual panels show how the relationship between wind speed and direction vary by year. However, the plots can be shown to vary in a very wide variety of ways e.g. day of the week, hour of the day, temperature, site type etc. - each offereing different insights into the character of pollutant concentrations.
In the second example we produce a bivariate polar plot. These plots can be very effective at detecting different source types. Carslaw et al. (2006) show how these plots were developed for use in source identification and characterisation. In the plot below the concentration of SO2 is shown using a colour scale. At the centre of the plot is zero wind speed, increasing as one moves towards the circumference (in this case to 21 m/s). This plot shows that for high wind speed conditions from the east, concentrations of SO2 at this location are high. The behaviour is unlike a ground-level source such as road transport where concentrations tend to decrease rapidly with increasing wind speed.
The reason wind speed is useful in this respect is to with the dispersion characteristics. It can be shown (using dispersion models for example) that maximum ground-level concentrations from a buoyant plume from chimney stack peak tend to peak for higher wind speeds. In this case, the source is most likely power stations to the east of London. We have also used such analysis to identify other source types such as aircraft NOX emissions.
Note also another feature that makes labelling of plots easy: openair recognises that ‘so2’ should be written as ‘SO2’ and formats it accordingly. This type of functionality can save time and allow users to focus on understanding the problem in hand rather than formatting plots.
polar.plot(mydata, pollutant = “so2”, main = “so2 at Marylebone Road”)

Another important example is the analysis of trends. There are many trend tests available and openair contains several. While it is useful to consider all the data available at once, often more insight is gained by splitting the data up in different ways. In the example below, the monthly trend in ozone at Marylebone Road is considered. However, several extensions are applied. First, because concentrations of ozone tend to be strongly seasonal, we choose to deseasonalise the data, which gives a better indication of monthly trends. Second, we choose to show the trends by wind sector. In the plot below it is deliberately laid out to represent the points of the compass for easy interpretation. In this case, for example, it is easy to see that positive trends in ozone are seen for northerly winds.
In the plot the red line shows the best trend estimate and the dashed line the estimated 95 % confidence interval in the trend line. The numbers at shown in the top left give the details. For example, when the wind is from the north-west there is a positive slope in ozone trend of 0.71 ppb/yr and the 95 % confidence interval is from 0.44-1.05 ppb/yr.
This and other functions run bootstrap simulations to provide more robust assessments of the trend and uncertainties in the trend. This essentially involves sampling from the original data many times to derive an estimated distribution of uncertainties. This sort of approaches is routinely available in R and is one of the many strengths of using it for data analysis.
MannKendall(mydata, pollutant = “o3”, type = “wd”, deseason = TRUE)

References
What next:
- Want to get a copy of openair?
- Want to get involved?
- (Want to Join the mailing group?)
