get_station_data {aire.zmvm}R Documentation

Download pollution data by station

Description

Retrieve pollution data by station, in the original units, from the air quality server at Consulta de Concentraciones, or for earlier years use the archive files available from Contaminante, or Meteorología for meteorological data. There's a mistake in the 2016 wind speed data, so for this year, and only this year, the alternative Excel file was used.

Usage

get_station_data(criterion, pollutant, year, progress = interactive())

Arguments

criterion

Type of data to download.

  • HORARIOS - Hourly data

  • MAXIMOS - Daily maximums

  • MINIMOS - Daily minimums

pollutant

The type of pollutant to download.

  • SO2 - Sulfur Dioxide (parts per billion)

  • CO - Carbon Monoxide (parts per million)

  • NOX - Nitrogen Oxides (parts per billion)

  • NO2 - Nitrogen Dioxide (parts per billion)

  • NO - Nitric Oxide (parts per billion)

  • O3 - Ozone (parts per billion)

  • PM10 - Particulate matter 10 micrometers or less (micrograms per cubic meter)

  • PM25 - Particulate matter 2.5 micrometers or less (micrograms per cubic meter)

  • WSP - Wind velocity (meters per second)

  • WDR - Wind direction (degrees)

  • TMP - Temperature (degrees Celsius)

  • RH - Relative humidity (percentage)

year

a numeric vector containing the years for which to download data (the earliest possible value is 1986)

progress

whether to display a progress bar (TRUE or FALSE). By default it will only display in an interactive session.

Details

Temperature (TMP) archive values are correct to one decimal place, but the most recent data is only available rounded to the nearest integer.

Value

A data.frame with pollution data. When downloading "HORARIOS" the hours correspond to the Etc/GMT+6 timezone, with no daylight saving time

Warning

The data for the current month is in the process of being validated

See Also

stations for a data.frame with the location and names of all pollution measuring stations,

Other raw data functions: get_station_month_data()

Examples

## Not run: 
## Download daily maximum PM10 data (particulate matter 10 micrometers or
## less in diameter) from 2015 to 2016
df <- get_station_data("MAXIMOS", "PM10", 2015:2016)
head(df)

## Download ozone concentration hourly data for 2016
df2 <- get_station_data("HORARIOS", "O3", 2016)

## Convert to local Mexico City time
df2$mxc_time <- format(as.POSIXct(paste0(df2$date, " ", df2$hour, ":00"),
                                  tz = "Etc/GMT+6"),
                       tz = "America/Mexico_City")
head(df2)

## End(Not run)

[Package aire.zmvm version 0.9.0 Index]