mirror of
https://github.com/dylanbenzi/hurricane_normalization_app.git
synced 2026-07-30 05:08:57 +00:00
update cost graph query
This commit is contained in:
@@ -75,6 +75,12 @@ view.all_conus_landfalls <- tbl(con, "all_conus_landfalls")
|
||||
# lf_id = 1
|
||||
#)
|
||||
|
||||
agnes <- list(
|
||||
storm_basin = "AL",
|
||||
storm_year = 1972,
|
||||
storm_name = "AGNES"
|
||||
)
|
||||
|
||||
# helper functions
|
||||
|
||||
# splits full_lf_id into lf_type and lf_id
|
||||
@@ -150,6 +156,26 @@ get_normalized_cost_index <- function(storm, full_lf_id) {
|
||||
return(result)
|
||||
}
|
||||
|
||||
# returns normalized mmh/mmp indexes and costs over time by storm
|
||||
get_all_normalized_cost_index <- function(storm) {
|
||||
query <- view.yearly_normalized_losses %>%
|
||||
filter(
|
||||
storm_basin == storm$storm_basin,
|
||||
storm_year == storm$storm_year,
|
||||
storm_name == storm$storm_name
|
||||
) %>%
|
||||
mutate(
|
||||
full_lf_id = paste0(lf_type, lf_id)
|
||||
) %>%
|
||||
select(
|
||||
normalization_year, mmh_index, mmp_index, mmh, mmp, full_lf_id
|
||||
)
|
||||
|
||||
result <- query %>% collect()
|
||||
|
||||
return(result)
|
||||
}
|
||||
|
||||
# returns landfalls and data at landfall from HURDAT
|
||||
get_hurdat_landfalls <- function(storm) {
|
||||
query <- view.hurdat_track %>%
|
||||
|
||||
Reference in New Issue
Block a user