Import sampling data from the EEA Air Quality Download Service API
Source:R/download_parquet.R
download-parquet.Rd
These functions are wrappers for the 'ParquetFile' endpoints of the European
Environment Agency's Air Quality Download Service API.
download_eea_parquet_files()
download zip file with all the filtered
parquet files in it. download_eea_parquet_async()
downloads this in the
background; the function returns an URL in which the file to be downloaded
will be generated. download_eea_parquet_urls()
returns a list of URLs
corresponding to the filtered parquets. download_eea_summary()
estimates
the number of files and their size, but does not return any data.
download_eea_country_city_spos()
returns a list of sampling points meeting
the criteria.
Usage
download_eea_parquet_files(
countries = "AD",
cities = NULL,
pollutants = NULL,
datetime_start = as.integer(format(Sys.Date(), "%Y")) - 1,
datetime_end = as.integer(format(Sys.Date(), "%Y")),
dataset = 1L,
aggregation_type = "hour",
email = NULL,
dynamic = FALSE,
file = tempfile(fileext = ".zip")
)
download_eea_parquet_async(
countries = "AD",
cities = NULL,
pollutants = NULL,
datetime_start = as.integer(format(Sys.Date(), "%Y")) - 1,
datetime_end = as.integer(format(Sys.Date(), "%Y")),
dataset = 1L,
aggregation_type = "hour",
email = NULL,
dynamic = FALSE
)
download_eea_parquet_urls(
countries = "AD",
cities = NULL,
pollutants = NULL,
datetime_start = as.integer(format(Sys.Date(), "%Y")) - 1,
datetime_end = as.integer(format(Sys.Date(), "%Y")),
dataset = 1L,
aggregation_type = "hour",
email = NULL
)
download_eea_country_city_spos(
countries = "AD",
cities = NULL,
pollutants = NULL,
datetime_start = as.integer(format(Sys.Date(), "%Y")) - 1,
datetime_end = as.integer(format(Sys.Date(), "%Y")),
dataset = 1L,
aggregation_type = "hour",
email = NULL
)
download_eea_summary(
countries = "AD",
cities = NULL,
pollutants = NULL,
datetime_start = as.integer(format(Sys.Date(), "%Y")) - 1,
datetime_end = as.integer(format(Sys.Date(), "%Y")),
dataset = 1L,
aggregation_type = "hour",
email = NULL
)
Arguments
- countries
A vector of country codes from
import_eea_countries()
. IfNULL
, data from all countries will be imported.- cities
A vector of cities in the given
countries
fromimport_eea_cities()
. IfNULL
, data from all cities in the givencountries
will be imported.- pollutants
A vector of pollutant notations or IDs from
import_eea_pollutants()
. IfNULL
, data for all pollutants will be imported.- datetime_start, datetime_end
Start and end date times, provided as
POSIXct
,Date
orinteger
R objects. If aninteger
is provided, this should represent the year of interest; fordatetime_start
this will be represent the first hour of the year and fordatetime_end
it will represent the last hour of the year, meaning providing the same integer to each will return a year of data.- dataset
The value of the dataset. One of:
Unverified data transmitted continuously (Up-To-Date/UTD/E2a) data from the beginning of the year.
Verified data (E1a) from 2013, reported by countries by 30 September each year for the previous year.
Historical Airbase data delivered between 2002 and 2012 before Air Quality Directive 2008/50/EC entered into force
- aggregation_type
represents whether the data collected is obtaining the values:
Hourly data (
"hour"
).Daily data (
"day"
).Variable intervals (different than the previous observations such as weekly, monthly, etc.) (
"var"
).
Optional field to identify the user who make the download and improve the communication if problems are detected.
- dynamic
If
TRUE
, will use a dynamic engine to create a single parquet file containing all results rather than downloading many separate parquet files.- file
The file to write the zip file to; should ideally end in
".zip"
. Defaults to a temporary file usingtempfile()
.
Value
One of:
download_eea_parquet_files()
: thefile
argument - the path to the downloaded ZIP file.download_eea_parquet_async()
: a path to the URL at which the ZIP file will be made available.download_eea_parquet_urls()
: a character vector of URLS to each parquet file.download_eea_summary()
: a numeric list, with namesnumberFiles
andsize
.download_eea_country_city_spos()
: adata.frame
containing thecountry
&sampling_point_id
.