Detect Storm Events from Forecast Data
detect_storm_events.RdFilters forecast data for wind speeds at or above the storm threshold.
Threshold is resolved in order: threshold_knots parameter, then
STORM_ALERT_THRESHOLD_KNOTS env var, then default of 34 knots (Beaufort 8).
Arguments
- forecasts
Tibble from
fetch_all_forecasts()orfetch_open_meteo_forecast().- threshold_knots
Numeric threshold in knots (default NULL, uses env var or 34).
- use_gusts
Logical; if TRUE (default), also flag rows where gusts exceed threshold.
Value
Tibble with columns: station_id, time, wind_speed_kn, wind_gust_kn, beaufort, description, is_gust_driven. Empty tibble if no storms detected.
Examples
forecasts <- tibble::tibble(
station_id = "M2",
time = Sys.time() + 3600 * 1:3,
wind_speed_kn = c(20, 38, 50),
wind_gust_kn = c(25, 45, 60)
)
detect_storm_events(forecasts)
#> # A tibble: 2 × 7
#> station_id time wind_speed_kn wind_gust_kn beaufort description
#> <chr> <dttm> <dbl> <dbl> <int> <chr>
#> 1 M2 2026-03-15 20:24:43 38 45 8 Gale
#> 2 M2 2026-03-15 21:24:43 50 60 10 Storm
#> # ℹ 1 more variable: is_gust_driven <lgl>