Learn R Programming

openair (version 0.5-11)

importSAQN: SAQN data import for openair

Description

Function for importing hourly mean Scottish Air Quality Network (SAQN) 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

importSAQN(site = "gla4", year = 2009, pollutant = "all")

Arguments

site
Site code of the SAQN site to import e.g. "gla4" is Glasgow Kerbside. Several sites can be imported with site = c("gla4", "ed") --- to import Glasgow Kerbside and Edinbrugh Centre 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").

Value

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

Details

The importSAQN function has been written to make it easy to import data from the Scottish Air Quality Network (SAQN) --- http://www.scottishairquality.co.uk/index.php. AEA have provided .RData files (R workspaces) of all individual sites and years for the SAQN. 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 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.
  • | ABD | Aberdeen Errol Place | URBAN BACKGROUND |
  • | ABD0 | Aberdeen Market Street 2 | ROADSIDE |
  • | ABD1 | Aberdeen Anderson Dr | ROADSIDE |
  • | ABD2 | Aberdeen Market St | ROADSIDE |
  • | ABD3 | Aberdeen Union Street Roadside | ROADSIDE |
  • | ABD8 | Aberdeen Wellington Road | ROADSIDE |
  • | ACTH | Auchencorth Moss | RURAL |
  • | AD1 | Aberdeen King Street | ROADSIDE |
  • | ALOA | Alloa | ROADSIDE |
  • | AYR | South Ayrshire Ayr High St | ROADSIDE |
  • | BRX | West Lothian Broxburn | ROADSIDE |
  • | BUSH | Bush Estate | RURAL |
  • | CUMN | East Ayrshire New Cumnock | URBAN BACKGROUND |
  • | CUPA | Fife Cupar | ROADSIDE |
  • | DUMF | Dumfries | ROADSIDE |
  • | DUN1 | Dundee Mains Loan | URBAN BACKGROUND |
  • | DUN3 | Dundee Union Street | URBAN CENTRE |
  • | DUN4 | Dundee Broughty Ferry Road | URBAN INDUSTRIAL |
  • | DUN5 | Dundee Seagate | KERBSIDE |
  • | DUN6 | Dundee Lochee Road | KERBSIDE |
  • | DUN7 | Dundee Whitehall Street | ROADSIDE |
  • | DUNF | Fife Dunfermline | ROADSIDE |
  • | ED | Edinburgh Centre | URBAN CENTRE |
  • | ED1 | Edinburgh St John's Road | KERBSIDE |
  • | ED2 | Edinburgh Med. Sch. | URBAN BACKGROUND |
  • | ED3 | Edinburgh St Leonards | URBAN BACKGROUND |
  • | ED4 | Edinburgh Roseburn | ROADSIDE |
  • | ED5 | Edinburgh Gorgie Road | ROADSIDE |
  • | ED6 | Edinburgh Haymarket | ROADSIDE |
  • | ED7 | Edinburgh Queen Street | ROADSIDE |
  • | ED8 | Edinburgh Salamander St | ROADSIDE |
  • | EDB1 | East Dunbartonshire Bishopbriggs | ROADSIDE |
  • | EDB2 | East Dunbartonshire Bearsden | ROADSIDE |
  • | EDB3 | East Dunbartonshire Kirkintilloch | ROADSIDE |
  • | EK | East Kilbride | SUBURBAN |
  • | EK0 | South Lanarkshire East Kilbride | ROADSIDE |
  • | ESK | Eskdalemuir | RURAL |
  • | FAL2 | Falkirk Park St | ROADSIDE |
  • | FAL3 | Falkirk Hope St | ROADSIDE |
  • | FAL5 | Falkirk Haggs | ROADSIDE |
  • | FAL6 | Falkirk West Bridge Street | ROADSIDE |
  • | FALK | Falkirk Grangemouth MC | URBAN BACKGROUND |
  • | FFAR | Angus Forfar | ROADSIDE |
  • | FINI | East Ayrshire Kilmarnock John Finnie St | ROADSIDE |
  • | FW | Fort William | SUBURBAN |
  • | GL1 | Glasgow Abercromby Street | ROADSIDE |
  • | GL2 | Glasgow Nithsdale Road | ROADSIDE |
  • | GL3 | Glasgow Broomhill | ROADSIDE |
  • | GLA | Glasgow City Chambers | URBAN BACKGROUND |
  • | GLA3 | Glasgow Centre | URBAN CENTRE |
  • | GLA4 | Glasgow Kerbside | KERBSIDE |
  • | GLA5 | Glasgow Anderston | URBAN BACKGROUND |
  • | GLA6 | Glasgow Byres Road | ROADSIDE |
  • | GLA7 | Glasgow Waulkmillglen Reservoir | RURAL |
  • | GLA8 | Glasgow Battlefield Road | ROADSIDE |
  • | GLAS | Glasgow Hope St | KERBSIDE |
  • | GRA2 | Grangemouth Moray | URBAN BACKGROUND |
  • | GRAN | Grangemouth | URBAN INDUSTRIAL |
  • | INV2 | Inverness | ROADSIDE |
  • | IRV | North Ayrshire Irvine High St | KERBSIDE |
  • | KILM | East Ayrshire Kilmarnock | URBAN BACKGROUND |
  • | KINC | Fife Kincardine | ROADSIDE |
  • | KIR | Fife Kirkcaldy | ROADSIDE |
  • | LER3 | Lerwick Staney Hill | URBAN BACKGROUND |
  • | LERW | Lerwick | RURAL |
  • | LING | West Lothian Linlithgow High Street | ROADSIDE |
  • | MID1 | Midlothian Pathhead | KERBSIDE |
  • | MID2 | Midlothian Dalkeith | ROADSIDE |
  • | MUSS | East Lothian Musselburgh N High St | ROADSIDE |
  • | NL1 | N Lanarkshire Coatbridge Whifflet | URBAN BACKGROUND |
  • | NL2 | N Lanarkshire Coatbridge Ellis St | ROADSIDE |
  • | NL3 | N Lanarkshire Chapelhall | ROADSIDE |
  • | NL4 | N Lanarkshire Croy | ROADSIDE |
  • | NL5 | N Lanarkshire Harthill | ROADSIDE |
  • | NL6 | N Lanarkshire Motherwell | ROADSIDE |
  • | NL7 | N Lanarkshire Shawhead Coatbridge | ROADSIDE |
  • | NL8 | N Lanarkshire Harthill West | URBAN BACKGROUND |
  • | NL9 | N Lanarkshire Moodiesburn | ROADSIDE |
  • | PAI2 | Paisley Glasgow Airport | AIRPORT |
  • | PAI3 | Paisley Gordon Street | ROADSIDE |
  • | PAIS | Paisley Central Road | ROADSIDE |
  • | PEEB | Peebles | SUBURBAN |
  • | PET1 | Perth Crieff | ROADSIDE |
  • | PET2 | Perth Atholl Street | ROADSIDE |
  • | PETH | Perth High Street | ROADSIDE |
  • | ROSY | Fife Rosyth | ROADSIDE |
  • | SHED | East Renfrewshire Sheddens | ROADSIDE |
  • | STRL | Stirling Craig's Roundabout | ROADSIDE |
  • | SV | Strath Vaich | RURAL |
  • | TARB | South Ayrshire Tarbolton | ROADSIDE |
  • | UPH | West Lothian Uphall | ROADSIDE |
  • | WDB1 | West Dunbartonshire John Knox St | AIRPORT |
  • | WDB2 | West Dunbartonshire Balloch | ROADSIDE |
  • | WDB3 | West Dunbartonshire Clydebank | ROADSIDE |
  • | WDB4 | West Dunbartonshire Glasgow Road | ROADSIDE |
  • | WHIT | West Lothian Whitburn | URBAN BACKGROUND |

See Also

See importAURN for data elsewhere in the UK and importKCL for importing comprehensive data in and around London.

Examples

Run this code
## import all pollutants from Glasgow Roadside
glas <- importSAQN(site = "gla4", year = 2000:2009)

## import all pollutants from Lerwick rural site (O3)
ler <- importSAQN(site = "lerw", year = 2005:2010)

## import all pollutants from Glasgow/Dundee Centre for 2009
all <- importSAQN(site = c("gla3", "dun3"), year = 2009)

Run the code above in your browser using DataLab