data-raw/05-calc_windmodel_data.R

## Be sure to re-build package after running 01 and 02 and before
## running this

data(hurr_tracks, package = "hurricaneexposuredata")
storms <- unique(hurr_tracks$storm_id)

library(stormwindmodel)
data(county_points, package = "stormwindmodel")

library(devtools)
library(dplyr)

storm_winds <- vector("list",
                      #length = 10)
                      length = length(storms))
for(i in 1:length(storm_winds)){
  print(storms[i])
  storm_track <- subset(hurr_tracks, storm_id == storms[i])
  winds <- get_grid_winds(hurr_track = storm_track,
                          grid_df = county_points) %>%
    dplyr::select(-glat, -glon) %>%
    dplyr::rename(fips = gridid) %>%
    dplyr::mutate(storm_id = storms[i])
  storm_winds[[i]] <- winds
}

storm_winds <- do.call("rbind", storm_winds)
devtools::use_data(storm_winds, overwrite = TRUE)
geanders/hurricaneexposuredata documentation built on May 14, 2017, 8:43 a.m.