View source: R/epa_aqs_downloadHourlyData.R
epa_aqs_downloadHourlyData | R Documentation |
Download hourly air quality data from the US EPA and save it to a directory.
EPA parameter codes and (start year) include:
– Ozone (1980)
– SO2 (1980)
– CO (1980)
– NO2 (1980)
– PM2.5 FRM/FEM (2008)
– PM2.5 non FRM/FEM (1998)
– PM10 (1988)
– PM2.5 Speciation(2001)
– PM10 Speciation (1988)
– Winds (1980)
– Temperature (1980)
– Barometric Pressure (1980)
– RH and Dewpoint (1980)
– HAPs (1993)
– VOCs (1980)
– Nitrous Oxides (1980)
epa_aqs_downloadHourlyData(
parameterCode = "88101",
year = NULL,
baseUrl = "https://aqs.epa.gov/aqsweb/airdata/",
downloadDir = tempdir(),
quiet = TRUE
)
parameterCode |
Character pollutant code. |
year |
Ingeter year. |
baseUrl |
Character base URL for the EPA AQS archive. |
downloadDir |
Directory where .zip file will be saved. |
quiet |
Logical passed on to |
Filepath of the downloaded zip file.
Unzipped CSV files are almost 100X larger than the compressed .zip files.
Depending on your internet connection speeds, downloading files from the EPA
site can take several minutes per file. If you see warning messages that you have
timed out, please download files manually. Functions that process these files
will then discover the downloaded files in the downloadDir
.
EPA AirData Pre-Generated Data Files
## Not run:
library(AirMonitorIngest)
# Create a directory specifically for EPA data
dir.create("~/Data/EPA", recursive = TRUE)
# Set logging level so messages and errors will appear in the console
MazamaCoreUtils::initializeLogging(logDir = "~/Data/EPA/")
logger.setLevel(TRACE)
# Save the download in ~/Data/EPA
zipFile <-
epa_aqs_downloadHourlyData(
parameterCode = "88101",
year = 2008,
downloadDir = "~/Data/EPA/",
quiet = FALSE
)
# Uncompress and parse into a tibble
tbl <- epa_aqs_parseHourlyData(zipFile)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.