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"
)

Arguments

sensor_data

data.table, a data.table of aggregated sensor data.

save_raw

logical, whether to save the raw data. Default is FALSE

save_location

character, relative path to save location

interval_length

nunmeric, interval length in hours. Default is 1.

station

character, ASOS station code. Default is "MSP" for the Minneapolis/St. Paul airport

time_zone

character, time zone code. Default is "America%2FChicago".

Value

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.

Details

For additional Minnesota station ID codes, see the Mesonet station directory.

Examples

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()
}