mirror of
https://github.com/dylanbenzi/hurricane_normalization_app.git
synced 2026-07-30 05:08:57 +00:00
add data population to calc
This commit is contained in:
@@ -1032,7 +1032,56 @@ calculator_storm_selection <- reactiveValues(
|
||||
full_lf_id = NULL,
|
||||
)
|
||||
|
||||
observeEvent(input$impact_populate_storm, {
|
||||
calculator_storm_selection$storm_basin = input$impact_storm_basin
|
||||
calculator_storm_selection$storm_year = input$impact_storm_year
|
||||
calculator_storm_selection$storm_name = input$impact_storm_name
|
||||
calculator_storm_selection$full_lf_id = input$impact_storm_full_lf_id
|
||||
|
||||
calculator_storm_details <- get_lf_type_factors(calculator_storm_selection)
|
||||
|
||||
updateTextInput(
|
||||
session,
|
||||
"impact_lat",
|
||||
value = calculator_storm_details$lat
|
||||
)
|
||||
|
||||
updateTextInput(
|
||||
session,
|
||||
"impact_lon",
|
||||
value = calculator_storm_details$lon
|
||||
)
|
||||
|
||||
updateTextInput(
|
||||
session,
|
||||
"impact_rmw",
|
||||
value = calculator_storm_details$rmw
|
||||
)
|
||||
|
||||
updateSliderInput(
|
||||
session,
|
||||
"impact_rmw_slider",
|
||||
value = calculator_storm_details$rmw
|
||||
)
|
||||
|
||||
updateTextInput(
|
||||
session,
|
||||
"impact_base_year",
|
||||
value = calculator_storm_details$storm_year
|
||||
)
|
||||
|
||||
updateTextInput(
|
||||
session,
|
||||
"impact_ref_year",
|
||||
value = "2024"
|
||||
)
|
||||
|
||||
updateTextInput(
|
||||
session,
|
||||
"impact_base_damage",
|
||||
value = calculator_storm_details$mwr
|
||||
)
|
||||
})
|
||||
```
|
||||
|
||||
Column {data-width=700}
|
||||
|
||||
@@ -58,7 +58,7 @@ view.all_conus_landfalls <- tbl(con, "all_conus_landfalls")
|
||||
view.hurdat_ids <- tbl(con, "hurdat_ids")
|
||||
view.all_lf_type_landfalls <- tbl(con, "all_lf_type_landfalls")
|
||||
view.lf_id_location <- tbl(con, "lf_id_location")
|
||||
|
||||
view.lf_landfall_gis <- tbl(con, "lf_landfall_gis")
|
||||
#qry <- econ.storm_base_loss %>%
|
||||
# left_join(view.hurdat_track, by = c("storm_basin", "storm_year", "storm_name"))
|
||||
|
||||
@@ -456,3 +456,27 @@ get_all_lf_type_landfalls <- function() {
|
||||
|
||||
return(result)
|
||||
}
|
||||
|
||||
# returns all storms and factors needed to normalize a lf type landfall
|
||||
get_all_lf_type_factors <- function() {
|
||||
query <- view.lf_landfall_gis
|
||||
|
||||
result <- query %>% collect()
|
||||
|
||||
return(result)
|
||||
}
|
||||
|
||||
# returns one storm and factors needed to normalize a lf type landfall
|
||||
get_lf_type_factors <- function(storm) {
|
||||
query <- view.lf_landfall_gis %>%
|
||||
filter(
|
||||
storm_basin == storm$storm_basin,
|
||||
storm_year == storm$storm_year,
|
||||
storm_name == storm$storm_name,
|
||||
full_lf_id == storm$full_lf_id
|
||||
)
|
||||
|
||||
result <- query %>% collect()
|
||||
|
||||
return(result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user