View source: R/Clarity_createOpenSynoptic.R
Clarity_createOpenSynoptic | R Documentation |
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
.
Clarity_createOpenSynoptic(
api_key = NULL,
format = c("USFS2", "USFS"),
baseUrl =
"https://clarity-data-api.clarity.io/v1/open/all-recent-measurement/pm25/hourly"
)
api_key |
Clarity API READ Key. If |
format |
Customized output format ("USFS2", "USFS"). |
baseUrl |
Base URL for the PurpleAir API. |
A Clarity Synoptic pas object.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.