epa_aqs_parseHourlyData: Parse hourly EPA air quality data

View source: R/epa_aqs_parseHourlyData.R

epa_aqs_parseHourlyDataR Documentation

Parse hourly EPA air quality data

Description

Uncompress previously downloaded, hourly air quality .zip files from the US EPA and parse the data into a tibble.

EPA parameter codes and (start year) include:

44201

– Ozone (1980)

42401

– SO2 (1980)

42101

– CO (1980)

42602

– NO2 (1980)

88101

– PM2.5 FRM/FEM (2008)

88502

– PM2.5 non FRM/FEM (1998)

81102

– PM10 (1988)

SPEC

– PM2.5 Speciation(2001)

PM10SPEC

– PM10 Speciation (1988)

WIND

– Winds (1980)

TEMP

– Temperature (1980)

PRESS

– Barometric Pressure (1980)

RH_DP

– RH and Dewpoint (1980)

HAPS

– HAPs (1993)

VOCS

– VOCs (1980)

NONOxNOy

– Nitrous Oxides (1980)

Usage

epa_aqs_parseHourlyData(zipFile = NULL, quiet = TRUE)

Arguments

zipFile

Absolute path to monitoring data .zip file

quiet

Logical passed on to readr::read_csv(progress = !quiet).

Value

Tibble of EPA air quality data.

Note

Unzipped CSV files are almost 100X larger than the compressed .zip files. CSV files are removed after data are read into a tibble.

References

EPA AirData Pre-Generated Data Files

file format description

Examples

## Not run: 
library(AirMonitorIngest)
library(MazamaCoreUtils)

# 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(2008, "88101", "~/Data/EPA/", quiet = FALSE)

# Uncompress and parse into a tibble
tbl <- epa_aqs_parseHourlyData(zipFile)

## End(Not run)

pnwairfire/AirMonitorIngest documentation built on Feb. 18, 2025, 7:50 p.m.