Stormwindmodel
Model Hurricane Wind Speeds
Install / Use
/learn @geanders/StormwindmodelREADME
Overview
The stormwindmodel package was created to allow users to model wind
speeds at grid points in the United States based on “best tracks”
hurricane tracking data, using a model for wind speed developed by
Willoughby and coauthors (2006). The package includes functions for
interpolating hurricane tracks and for modeling and mapping wind speeds
during the storm. It includes population mean center locations for all
U.S. counties, which can be used to map winds by county; however, other
grid point locations can also be input for modeling. Full details on how
this model is fit are provided in the “Details” vignette of the
stormwindmodel package.
This package is currently in development on GitHub. You can install it
using the install_github function from the devtools package using:
devtools::install_github("geanders/stormwindmodel", build_vignettes = TRUE)
Package example data
For examples, the package includes data on the tracks of Hurricane Floyd in 1999 and Hurricane Katrina in 2005. You can load these example best tracks data sets using:
library(stormwindmodel)
data("floyd_tracks")
head(floyd_tracks)
#> # A tibble: 6 x 4
#> date latitude longitude wind
#> <chr> <dbl> <dbl> <dbl>
#> 1 199909071800 14.6 -45.6 25
#> 2 199909080000 15 -46.9 30
#> 3 199909080600 15.3 -48.2 35
#> 4 199909081200 15.8 -49.6 40
#> 5 199909081800 16.3 -51.1 45
#> 6 199909090000 16.7 -52.6 45
data("katrina_tracks")
head(katrina_tracks)
#> # A tibble: 6 x 4
#> date latitude longitude wind
#> <chr> <dbl> <dbl> <dbl>
#> 1 200508231800 23.1 -75.1 30
#> 2 200508240000 23.4 -75.7 30
#> 3 200508240600 23.8 -76.2 30
#> 4 200508241200 24.5 -76.5 35
#> 5 200508241800 25.4 -76.9 40
#> 6 200508250000 26 -77.7 45
This example data includes the following columns:
date: Date and time of the observation (in UTC)latitude,longitude: Location of the storm at that timewind: Maximum wind speed at that time (knots)
You can input other storm tracks into the wind modeling functions in the
stormwindmodel package, but you must have your storm tracks in the
same format as these example dataframes and with these columns names to
input the tracks to the functions in stormwindmodel. If necessary, use
rename from dplyr to rename columns and convert_wind_speed from
weathermetrics to convert windspeed into knots.
The stormwindmodel package also includes a dataset with the location
of the population mean center of each U.S. county (county_points).
This dataset can be used as the grid point inputs if you want to model
storm-related winds for counties. These counties are listed by Federal
Information Processing Standard (FIPS) number, which uniquely identifies
each U.S. county. This dataset comes from the US Census file of county
population mean center
locations,
as of the 2010 Census.
data(county_points)
head(county_points)
#> gridid glat glon
#> 1 01001 32.50039 -86.49416
#> 2 01003 30.54892 -87.76238
#> 3 01005 31.84404 -85.31004
#> 4 01007 33.03092 -87.12766
#> 5 01009 33.95524 -86.59149
#> 6 01011 32.11633 -85.70119
You can use a different dataset of grid points to model winds at other
U.S. locations, including across evenly spaced grid points. However, you
will need to include these grid points in a dataframe with a similar
format to this example dataframe, with columns for each grid point id
(gridid— these IDs can be random but should be unique across grid
points), and glat and glon for latitude and longitude of each grid
point.
Basic example
The main function of this package is get_grid_winds. It inputs storm
tracks for a tropical cyclone (hurr_track) and a dataframe with grid
point locations (grid_df). It models winds during the tropical storm
at each grid point and outputs summaries of wind during the storm at
each grid point from the storm. The wind measurements generated for each
grid point are:
vmax_gust: Maximum 10-m 1-minute gust wind experienced at the grid point during the stormvmax_sust: Maximum 10-m 1-minute sustained wind experienced at the grid point during the stormgust_dur: Duration gust wind was at or above a specified speed (default is 20 m/s), in minutessust_dur: Duration sustained wind was at or above a specified speed (default is 20 m/s), in minutes
To get modeled winds for Hurricane Floyd at U.S. county centers, you can run:
floyd_winds <- get_grid_winds(hurr_track = floyd_tracks,
grid_df = county_points)
#> Warning: `mutate_()` is deprecated as of dplyr 0.7.0.
#> Please use `mutate()` instead.
#> See vignette('programming') for more help
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated.
#> Warning: `select_()` is deprecated as of dplyr 0.7.0.
#> Please use `select()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated.
#> Warning: `summarise_()` is deprecated as of dplyr 0.7.0.
#> Please use `summarise()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated.
floyd_winds %>%
dplyr::select(gridid, vmax_gust, vmax_sust, gust_dur, sust_dur) %>%
slice(1:6)
#> gridid vmax_gust vmax_sust gust_dur sust_dur
#> 1 01001 2.971364 1.994204 0 0
#> 2 01003 1.958180 1.314215 0 0
#> 3 01005 4.806562 3.225880 0 0
#> 4 01007 2.309274 1.549848 0 0
#> 5 01009 2.600039 1.744992 0 0
#> 6 01011 4.077514 2.736587 0 0
If you use the coutny_points data that comes with the package for the
grid_df argument, you will model winds for county centers. In this
case, the gridid is a county FIPS, and the stormwindmodel package
has a function called map_wind for mapping the estimated winds for
each county. By default, it maps the maximum sustained wind in each
county during the storm in meters per second.
map_wind(floyd_winds)
<!-- -->
Further functionality
Options for modeling winds
You can input the track for any Atlantic Basin tropical storm into
get_grid_winds, as long as you convert it to meet the following format
requirements:
- Is a dataframe of class
tbl_df(you can use thetbl_dffunction fromdplyrto do this) - Has the following columns:
date: A character vector with date and time (in UTC), expressed as YYYYMMDDHHMM.latitude: A numeric vector with latitude in decimal degrees.longitude: A numeric vector with longitude in decimal degrees.wind: A numeric vector with maximum storm wind speed in knots
For the grid point locations at which to model, you can input a
dataframe with grid points anywhere in the eastern half of the United
States. For example, you may want to map wind speeds for Hurricane
Katrina by census tract in Orleans Parish, LA. The following code shows
how a user could do that with the stormwindmodel package.
First, the tigris package can be used to pull US Census tract
shapefiles for a county. You can use the following code to pull these
census tract file shapefiles for Orleans Parish in Louisiana:
library(tigris)
new_orleans <- tracts(state = "LA", county = c("Orleans"),
class = "sp")
This shapefile gives the polygon for each census tract. You can use the
gCentroid function from the rgeos package to determine the location
of the center of each census tract:
library(rgeos)
new_orleans_tract_centers <- gCentroid(new_orleans, byid = TRUE)@coords
head(new_orleans_tract_centers)
#> x y
#> 1 -89.95393 30.04011
#> 2 -89.91693 30.03769
#> 30 -90.01988 29.95959
#> 31 -90.07362 29.97811
#> 32 -90.12008 29.91933
#> 46 -90.08967 29.94482
With some cleaning, you can get this data to the format required for the
get_grid_winds function. In particular, you should add the tract id
from the original shapefiles as the grid id, as this will help you map
the modeled wind results:
new_orleans_tract_centers <- new_orleans_tract_centers %>%
tbl_df() %>%
mutate(gridid = unique(new_orleans@data$TRACTCE)) %>%
dplyr::rename(glat = y,
glon = x)
#> Warning: `tbl_df()` is deprecated as of dplyr 1.0.0.
#> Please use `tibble::as_tibble()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated.
head(new_orleans_tract_centers)
#> # A tibble: 6 x 3
#> glon glat gridid
#> <dbl> <dbl> <chr>
#> 1 -90.0 30.0 001747
#> 2 -89.9 30.0 001750
#> 3 -90.0 30.0 000800
#> 4 -90.1 30.0 003600
#> 5 -90.1 29.9 011400
#> 6 -90.1 29.9 008600
Here is a map of the census tracts, with the center point of each shown
with a red dot (note that an area over water is also included– this is
included as one of the census tract shapefiles pulled by tigris for
Orleans Parish):
library(sf)
new_orleans <- new_orleans %>%
st_as_sf()
new_orleans_centers <- new_orleans_tract_centers %>%
st_as_sf(coords = c("glon", "glat")) %>%
st_set_crs(4269)
library(ggplot2)
ggplot() +
geom_sf(data = new_orleans) +
geom_sf(data = new_orleans_centers, color = "red", size = 0.6)
<!-- -->
Sinc
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
