airnow_getSites_v1: Download and parse AirNow sites metadata

View source: R/airnow_getSites_v1.R

airnow_getSites_v1R Documentation

Download and parse AirNow sites metadata

Description

The https://airnowtech.org site provides both air pollution monitoring data as well as monitoring site location metadata. This function retrieves the most recent version of the site location metadata file and returns it as a tibble.

A description of the data format is publicly available at the Monitoring Site Fact Sheet.

Usage

airnow_getSites_v1(
  url = "https://files.airnowtech.org/airnow/today/monitoring_site_locations.dat",
  quiet = TRUE
)

Arguments

url

URL of the AirNow monitoring site locations file.

quiet

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

Value

Tibble of AirNow site metadata.

Note

As of October, 2021, the description above is incorrect. See the source code for this function for a correct set of field names.

As of October, 2021, the monitoring_site_locations.dat file has an encoding of "CP437" (aka "Non-ISO extended-ASCII" or "IBMPC 437") and will be converted to "UTF-8" so that French and Spanish language place names are properly encoded in the returned dataframe.

Examples

## Not run: 
library(AirMonitorIngest)

# Create a directory specifically for AirNow data
dir.create("~/Data/AirNow", recursive = TRUE)

# Set logging level so messages and errors will appear in the console
MazamaCoreUtils::initializeLogging(logDir = "~/Data/AirNow")
logger.setLevel(TRACE)

# Download and parse site metadata
airnow_sites <- airnow_getSites_v1()

## End(Not run)

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