air_quality: Retrieve air quality data from the Open-Meteo API

View source: R/air_quality.R

air_qualityR Documentation

Retrieve air quality data from the Open-Meteo API

Description

air_quality() calls the Open-Meteo Air Quality API to obtain pollutant, pollen, and particulate data. Historical and forecasted data is available.

Refer to the API documentation at: https://open-meteo.com/en/docs/air-quality-api

Usage

air_quality(
  location,
  start = NULL,
  end = NULL,
  hourly = NULL,
  timezone = "auto"
)

Arguments

location

Required. The location for which data will be retrieved. Supplied as either a c(latitude,longitude) WGS84 coordinate pair or a place name string (with co-ordinates obtained via geocode()).

start, end

Start and end dates in ISO 8601 (e.g. "2020-12-31"). If no dates are supplied, data for the next 5 days will be provided by default.

hourly

Required. An air quality variable accepted by the API, or list thereof. See details below.

timezone

specify timezone for time data as a string, i.e. "australia/sydney" (defaults to "auto", the timezone local to the specified location).

Details

You will need to specify at least one air quality variable, such as PM10 or Carbon Monoxide, that you want forecasted data for. These variables are sampled or aggregated at hourly intervals, and can be supplied as a list to request multiple variables over the same time period.

Example hourly air quality variables include:

Variable Description
pm10 Particulate matter smaller than 10 micrometers across
carbon_monoxide 10m concentration in micrograms per cubic meter
european_aqi European Air Quality Index
us_aqi United States Air Quality Index
dust Saharan dust particles 10m above ground

Full documentation for the forecast API is available at: https://open-meteo.com/en/docs/air-quality-api

Value

Requested air quality data for the given location and time, as a tidy tibble.

Examples


# obtain Carbon Monoxide levels for Beijing over the next 5 days
air_quality("Beijing", hourly = "carbon_monoxide")


openmeteo documentation built on Oct. 25, 2023, 5:07 p.m.