Learn R Programming

openair (version 0.5-11)

importAURN: AURN data import for openair

Description

Function for importing hourly mean UK Automatic Urban and Rural Network (AURN) air quality archive data files for use with the openair package. Files are imported from a remote server operated by AEA that provides air quality data files as R data objects.

Usage

importAURN(site = "my1", year = 2009, pollutant = "all",
  hc = FALSE)

Arguments

site
Site code of the AURN site to import e.g. "my1" is Marylebone Road. Several sites can be imported with site = c("my1", "nott") --- to import Marylebone Road and Nottingham for example.
year
Year or years to import. To import a sequence of years from 1990 to 2000 use year = 1990:2000. To import several specfic years use year = c(1990, 1995, 2000) for example.
pollutant
Pollutants to import. If omitted will import all pollutants ffrom a site. To import only NOx and NO2 for example use pollutant = c("nox", "no2").
hc
A few sites have hydrocarbon measurements available and setting hc = TRUE will ensure hydrocarbon data are imported. The default is however not to as most users will not be interested in using hydrocarbon data and the resulting da

Value

  • Returns a data frame of hourly mean values with date in POSIXct class and time zone GMT.

Details

The importAURN function has been written to make it easy to import data from the UK AURN. AEA have provided .RData files (R workspaces) of all individual sites and years for the AURN. These files are updated on a daily basis. This approach requires a link to the Internet to work. There are several advantages over the web portal approach where .csv files are downloaded. First, it is quick to select a range of sites, pollutants and periods (see examples below). Second, storing the data as .RData objects is very efficient as they are about four times smaller than .csv files --- which means the data downloads quickly and saves bandwidth. Third, the function completely avoids any need for data manipulation or setting time formats, time zones etc. Finally, it is easy to import many years of data beyond the current limit of about 64,000 lines. The final point makes it possible to download several long time series in one go. The function also has the advantage that the proper site name is imported and used in openair functions. The site codes and pollutant names can be upper or lower case. The function will issue a warning when data less than six months old is downloaded, which may not be ratified. The data are imported by stacking sites on top of one another and will have field names site, code (the site code) and pollutant. Sometimes it is useful to have columns of site data. This can be done using the reshape function --- see examples below. All units are expressed in mass terms for gaseous species (ug/m3 for NO, NO2, NOx (as NO2), SO2 and hydrocarbons; and mg/m3 for CO). PM10 concentrations are provided in gravimetric units of ug/m3 or scaled to be comparable with these units. Over the years a variety of instruments have been used to measure particulate matter and the technical issues of measuring PM10 are complex. In recent years the measurements rely on FDMS (Filter Dynamics Measurement System), which is able to measure the volatile component of PM. In cases where the FDMS system is in use there will be a separate volatile component recorded as 'v10', which is already included in the absolute PM10 measurement. Prior to the use of FDMS the measurements used TEOM (Tapered Element Oscillating. Microbalance) and these concentrations have been multiplied by 1.3 to provide an estimate of the total mass including the volatile fraction. The few BAM (Beta-Attenuation Monitor) instruments that have been incorporated into the network throughout its history have been scaled by 1.3 if they have a heated inlet (to account for loss of volatile particles) and 0.83 if they do not have a heated inlet. The few TEOM instruments in the network after 2008 have been scaled using VCM (Volatile Correction Model) values to account for the loss of volatile particles. The object of all these scaling processes is to provide a reasonable degree of comparison between data sets and with the reference method and to produce a consistent data record over the operational period of the network, however there may be some discontinuity in the time series associated with instrument changes. No corrections have been made to teh PM2.5 data. The volatile component of FDMS PM2.5 (where available) is shown in the 'v2.5' column. While the function is being developed, the following site codes should help with selection.
  • A3 London A3 Roadside
  • ABD Aberdeen
  • ABD7 Aberdeen Union Street Roadside
  • ACTH Auchencorth Moss
  • AH Aston Hill
  • BAR2 Barnsley 12
  • BAR3 Barnsley Gawber
  • BARN Barnsley
  • BATH Bath Roadside
  • BEL Belfast East
  • BEL2 Belfast Centre
  • BEL4 Belfast Clara St
  • BEX London Bexley
  • BHAM Birmingham
  • BIL Billingham
  • BIR Bircotes
  • BIR1 Birmingham Tyburn
  • BIR2 Birmingham East
  • BIRM Birmingham Centre
  • BIRT Birmingham Tyburn Roadside
  • BLAC Blackpool
  • BLC2 Blackpool Marton
  • BLCB Blackburn Darwen Roadside
  • BOLT Bolton
  • BORN Bournemouth
  • BOT Bottesford
  • BRAD Bradford Centre
  • BREN London Brent
  • BRI London Bridge Place
  • BRIS Bristol Centre
  • BRIT Brighton Roadside
  • BRN Brentford Roadside
  • BRS2 Bristol Old Market
  • BRS8 Bristol St Paul's
  • BRT3 Brighton Preston Park
  • BURY Bury Roadside
  • BUSH Bush Estate
  • BY1 Bromley Roadside
  • BY2 London Bromley
  • CA1 Camden
  • CAM Cambridge Roadside
  • CAMB Cambridge
  • CAN London Canvey
  • CANT Canterbury
  • CAR Cardiff
  • CARD Cardiff Centre
  • CARL Carlisle Roadside
  • CHIL Chilworth
  • CHP Chepstow A48
  • CHS6 Chesterfield
  • CHS7 Chesterfield Roadside
  • CLL Central London
  • CLL2 London Bloomsbury
  • COV2 Coventry Centre
  • COV3 Coventry Memorial Park
  • CRD London Cromwell Road
  • CRD2 London Cromwell Road 2
  • CWMB Cwmbran
  • DERY Derry
  • DUMF Dumfries
  • EAGL Stockton-on-Tees Eaglescliffe
  • ECCL Salford Eccles
  • ED Edinburgh Centre
  • ED3 Edinburgh St Leonards
  • EX Exeter Roadside
  • FEA Featherstone
  • FW Fort William
  • GDF Great Dun Fell
  • GLA Glasgow City Chambers
  • GLA3 Glasgow Centre
  • GLA4 Glasgow
  • GLAS Glasgow Hope St
  • GLAZ Glazebury
  • GRA2 Grangemouth Moray
  • GRAN Grangemouth
  • HAR Harwell
  • HARR London Harrow
  • HG1 Haringey Roadside
  • HG2 London Haringey
  • HIL London Hillingdon
  • HM High Muffles
  • HOPE Stanford-le-Hope Roadside
  • HORE Horley
  • HORS London Westminster
  • HOVE Hove Roadside
  • HR3 London Harrow Stanmore
  • HRL London Harlington
  • HS1 Hounslow Roadside
  • HUL2 Hull Freetown
  • HULL Hull Centre
  • INV2 Inverness
  • ISL London Islington
  • LB Ladybower
  • LEAM Leamington Spa
  • LED6 Leeds Headingley
  • LEED Leeds Centre
  • LEIC Leicester Centre
  • LEOM Leominster
  • LERW Lerwick
  • LH Lullington Heath
  • LINC Lincoln Roadside
  • LIVR Liverpool Centre
  • LN Lough Navar
  • LON6 London Eltham
  • LV6 Liverpool Queen's Drive Roadside
  • LVP Liverpool Speke
  • LW1 London Lewisham
  • MAN Manchester Town Hall
  • MAN3 Manchester Piccadilly
  • MAN4 Manchester South
  • MH Mace Head
  • MID Middlesbroug
  • MY1 London Marylebone Road
  • NCA3 Newcastle Cradlewell Roadside
  • NEWC Newcastle Centre
  • NO10 Norwich Forum Roadside
  • NOR1 Norwich Roadside
  • NOR2 Norwich Centre
  • NOTT Nottingham Centre
  • NPT3 Newport
  • NTON Northampton
  • OLDB Sandwell Oldbury
  • OSY St Osyth
  • OX Oxford Centre Roadside
  • OX3 Oxford St Ebbes
  • PEMB Narberth
  • PLYM Plymouth Centre
  • PMTH Portsmouth
  • PRES Preston
  • PT Port Talbot
  • PT4 Port Talbot Margam
  • REA1 Reading New Town
  • READ Reading
  • REDC Redcar
  • ROCH Rochester Stoke
  • ROTH Rotherham Centre
  • RUGE Rugeley
  • SALT Saltash Roadside
  • SCN2 Scunthorpe Town
  • SCUN Scunthorpe
  • SDY Sandy Roadside
  • SEND Southend-on-Sea
  • SHE Sheffield Tinsley
  • SHE2 Sheffield Centre
  • SIB Sibton
  • SOM Somerton
  • SOUT Southampton Centre
  • STE Stevenage
  • STEW Stewartby
  • STOC Stockport
  • SUN2 Sunderland Silksworth
  • SUND Sunderland
  • SUT1 Sutton Roadside
  • SUT3 London Sutton
  • SV Strath Vaich
  • SWA1 Swansea Roadside
  • SWAN Swansea
  • TED London Teddington
  • TH2 Tower Hamlets Roadside
  • THUR Thurrock
  • TRAN Wirral Tranmere
  • WA2 London Wandsworth
  • WAL Walsall Alumwell
  • WAL2 Walsall Willenhall
  • WAR Warrington
  • WBRO Sandwell West Bromwich
  • WC Wharleycroft
  • WEYB Weybourne
  • WFEN Wicken Fen
  • WIG3 Wigan Leigh
  • WIG5 Wigan Centre
  • WL West London
  • WOLV Wolverhampton Centre
  • WRAY Wray
  • WREX Wrexham
  • YARM Stockton-on-Tees Yarm
  • YW Yarner Wood

See Also

importKCL, importADMS, importSAQN

Examples

Run this code
## import all pollutants from Marylebone Rd from 1990:2009
mary <- importAURN(site = "my1", year = 2000:2009)

## import nox, no2, o3 from Marylebone Road and Nottingham Centre for 2000
thedata <- importAURN(site = c("my1", "nott"), year = 2000,
pollutant = c("nox", "no2", "o3"))

## import over 20 years of Mace Head O3 data!
o3 <- importAURN(site = "mh", year = 1987:2009)

## import hydrocarbon (and other) data from Marylebone Road
mary <- importAURN(site = "my1", year =1998, hc = TRUE)

## reshape the data so that each column represents a pollutant/site
thedata <- importAURN(site = c("nott", "kc1"), year = 2008,
pollutant = "o3")
thedata <- melt(thedata, measure.vars = "o3")
thedata <- dcast(thedata, ... ~ variable + site + code)
## thedata now has columns  o3_Nottingham Centre_NOTT o3_London N. Kensington_KC1
## now can export as a csv file:
write.csv(thedata, file = "~/temp/thedata.csv")

Run the code above in your browser using DataLab