wind_exposure: Write storm wind exposure files

Description Usage Arguments Value Note Examples

View source: R/wind_exposure.R

Description

This function takes an input of locations (either a vector of county FIPS or a dataframe of multi-county FIPS, with all FIPS listed for each county) and creates time series dataframes that can be merged with health time series, giving the dates and exposures for all storms meeting the given storm wind criteria.

Usage

1
2
3
4
5
6
7
8
9
wind_exposure(
  locations,
  start_year,
  end_year,
  wind_limit,
  wind_var,
  out_dir,
  out_type = "csv"
)

Arguments

locations

Either a vector of FIPS county codes, for county-level output, or a dataframe with columns for community identifier (commun) and associated FIPS codes (fips), for multi-county community output. See the examples for the proper format for this argument.

start_year

Four-digit integer with first year to consider.

end_year

Four-digit integer with last year to consider.

wind_limit

Vector giving the wind speed (in m / s) to use as a threshold for classifying a county as "exposed" to a specific storm.

wind_var

A character string giving the wind variable to use. Choices are "vmax_sust" (maximum sustained winds; default), "vmax_gust" (maximum gust winds), "sust_dur" (minutes of sustained winds of 20 m / s or higher) and "gust_dur" (minutes of gust winds of 20 m / s or higher). If the Extended Best Tracks wind radii are used as the source of wind data, the "gust_dur" option cannot be selected.

out_dir

Character string giving the pathname of the directory in which to write output. This directory should already exist on your computer.

out_type

Character string giving the type of output files you'd like. Options are "csv" (default) and "rds".

Value

Writes out a directory with rain exposure files for each county or community indicated. For more on the columns in this output, see the documentation for county_wind and multi_county_wind.

Note

This function allows you to use different wind variables (sustained winds, which is the default; gust winds; duration of sustained winds; duration of gust winds) when pulling exposures by county. However, if pulling multi-county communities, currently only the sustained winds metric can be used with this function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 
# Ensure that data package is available before running the example.
#  If it is not, see the `hurricaneexposure` package vignette for details
# on installing the required data package.
if (requireNamespace("hurricaneexposuredata", quietly = TRUE)) {

# You will need a directory named "tmp" in your home directory to
# run these examples.

# By county
wind_exposure(locations = c("22071", "51700"),
              start_year = 1988, end_year = 2005,
              wind_limit = 10,
              out_dir = "~/tmp/storms")

# For multi-county communities
communities <- data.frame(community_name = c(rep("ny", 6), "no", "new"),
                          fips = c("36005", "36047", "36061",
                          "36085", "36081", "36119",
                          "22071", "51700"))
wind_exposure(locations = communities,
              start_year = 1988, end_year = 2005,
              wind_limit = 10,
              out_dir = "~/tmp/storms")
}

## End(Not run)

Example output

To use this package, you must install the hurricaneexposuredata
package. To install that package, run
`install.packages('hurricaneexposuredata',
repos='https://geanders.github.io/drat/', type='source')`. See the
`hurricaneexposure` vignette for more details.

hurricaneexposure documentation built on March 26, 2020, 8 p.m.