Clarity_createOpenSynoptic: Create a new Clarity synoptic dataset

View source: R/Clarity_createOpenSynoptic.R

Clarity_createOpenSynopticR Documentation

Create a new Clarity synoptic dataset

Description

Download, parse and enhance synoptic data from Clarity and return the results as a useful tibble with class clarity_synoptic.

Steps include:

1) Download and parse synoptic data

2) Replace variable names with more consistent, more human readable names.

3) Add spatial metadata for each sensor including:

  • timezone – olson timezone

  • countryCode – ISO 3166-1 alpha-2

  • stateCode – ISO 3166-2 alpha-2

4) Convert data types from character to POSIXct and numeric.

Usage

Clarity_createOpenSynoptic(
  api_key = NULL,
  format = c("USFS2", "USFS"),
  baseUrl =
    "https://clarity-data-api.clarity.io/v1/open/all-recent-measurement/pm25/hourly"
)

Arguments

api_key

Clarity API READ Key. If api_key = NULL, it will be obtained using getAPIKey("Clarity-read").

format

Customized output format ("USFS2", "USFS").

baseUrl

Base URL for the PurpleAir API.

Value

A Clarity Synoptic pas object.

Examples


# Fail gracefully if any resources are not available
try({

library(AirSensor2)

initializeMazamaSpatialUtils()

synoptic <-
  Clarity_createOpenSynoptic(
    api_key = Clarity_API_READ_KEY,
    format = "USFS2"
  )

pas %>% pas_leaflet()

}, silent = FALSE)


MazamaScience/AirSensor2 documentation built on Oct. 31, 2024, 1:39 a.m.