R/add_weather.R
add_weather.Rd
Access temperature, precipitation, wind speed, and visibility measures for a given ASOS station in Minnesota.
add_weather(
sensor_data,
save_raw = FALSE,
save_location = ".",
interval_length = 1,
station = "MSP",
time_zone = "America%2FChicago"
)
data.table, a data.table of aggregated sensor data.
logical, whether to save the raw data. Default is FALSE
character, relative path to save location
nunmeric, interval length in hours. Default is 1
.
character, ASOS station code. Default is "MSP"
for the Minneapolis/St. Paul airport
character, time zone code. Default is "America%2FChicago"
.
the original data.table with columns added:
tmpf.mean
numeric, the mean temperature in Fahrenheit
p01i.sum
numeric, the total precipitation in inches
p01i.mean
numeric, the mean precipitation in inches
sknt.mean
numeric, the mean wind speed in knots
vsby.mean
numeric, the mean visibility distance in miles
See Mesonet for additional variables and descriptions.
For additional Minnesota station ID codes, see the Mesonet station directory.
if (FALSE) {
library(tc.sensors)
library(dplyr)
config <- pull_configuration()
config_sample <- dplyr::filter(config, config$detector_abandoned == "f") %>%
dplyr::sample_n(1)
yesterday <- as.Date(Sys.Date() - 365)
sensor_results <- pull_sensor(
sensor = config_sample$detector_name[[1]],
pull_date = yesterday
)
aggregate_sensor(sensor_results,
interval_length = 1,
config = config_sample
) %>%
add_weather()
}