mirror of
https://github.com/dylanbenzi/hurricane_normalization_app.git
synced 2026-07-30 05:08:57 +00:00
add storm selector logic to calc
This commit is contained in:
+28
-2
@@ -81,6 +81,8 @@ latest_normalized_losses <- get_latest_aggregate_losses()
|
||||
|
||||
all_conus_landfalls <- get_all_conus_landfalls()
|
||||
|
||||
all_lf_type_storms <- get_all_lf_type_landfalls()
|
||||
|
||||
storm_selection <- reactiveValues(
|
||||
storm_year = NULL,
|
||||
storm_name = NULL,
|
||||
@@ -1065,6 +1067,30 @@ Column {data-width=300}
|
||||
```{r}
|
||||
# Calculator - Input
|
||||
# TODO: add data population and compute
|
||||
#observeEvent(input$stormYear, {
|
||||
# stormsByChosenYear <- loss_storms[loss_storms$storm_year == input$stormYear, ]
|
||||
#
|
||||
# stormsByYear <- loss_storms %>% filter(storm_year == input$stormYear)
|
||||
#
|
||||
# updateSelectInput(
|
||||
# session,
|
||||
# "stormName",
|
||||
# choices = stormsByYear$storm_name,
|
||||
# selected = NULL
|
||||
# )
|
||||
#})
|
||||
observeEvent(input$impact_storm_year, {
|
||||
stormsByChosenYear <- all_lf_type_storms[all_lf_type_storms$storm_year == input$impact_storm_year, ]
|
||||
|
||||
stormsByYear <- all_lf_type_storms %>% filter(storm_year == input$impact_storm_year)
|
||||
|
||||
updateSelectInput(
|
||||
session,
|
||||
"impact_storm_name",
|
||||
choices = stormsByYear$storm_name,
|
||||
selected = NULL
|
||||
)
|
||||
})
|
||||
|
||||
div(
|
||||
h6("Storm Selector"),
|
||||
@@ -1077,13 +1103,13 @@ div(
|
||||
selectInput(
|
||||
"impact_storm_year",
|
||||
label = NULL,
|
||||
choices = 1926,
|
||||
choices = all_lf_type_storms$storm_year,
|
||||
width = "100%"
|
||||
),
|
||||
selectInput(
|
||||
"impact_storm_name",
|
||||
label = NULL,
|
||||
choices = "GREAT MIAMI",
|
||||
choices = NULL,
|
||||
width = "100%"
|
||||
),
|
||||
|
||||
|
||||
@@ -55,6 +55,11 @@ view.yearly_normalized_losses <- tbl(con, "yearly_normalized_losses")
|
||||
view.simplified_county_geom <- tbl(con, "simplified_county_geom")
|
||||
view.all_loss_storms_tracks <- tbl(con, "all_loss_storms_tracks")
|
||||
view.all_conus_landfalls <- tbl(con, "all_conus_landfalls")
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
view.hurdat_ids <- tbl(con, "hurdat_ids")
|
||||
view.all_lf_type_landfalls <- tbl(con, "all_lf_type_landfalls")
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
#qry <- econ.storm_base_loss %>%
|
||||
# left_join(view.hurdat_track, by = c("storm_basin", "storm_year", "storm_name"))
|
||||
@@ -110,6 +115,15 @@ get_all_loss_storms <- function() {
|
||||
return(result)
|
||||
}
|
||||
|
||||
# returns a list of all stored hurdat ids
|
||||
get_all_hurdat_ids <- function() {
|
||||
query <- view.hurdat_ids
|
||||
|
||||
result <- query %>% collect()
|
||||
|
||||
return(result)
|
||||
}
|
||||
|
||||
# returns a list of latest normalized losses
|
||||
get_latest_aggregate_losses <- function() {
|
||||
query <- view.all_normalized_losses
|
||||
@@ -435,3 +449,12 @@ get_normalized_metric_growth <- function(storm, full_lf_id) {
|
||||
|
||||
return(result)
|
||||
}
|
||||
|
||||
# returns all lf type landfalls
|
||||
get_all_lf_type_landfalls <- function() {
|
||||
query <- view.all_lf_type_landfalls
|
||||
|
||||
result <- query %>% collect()
|
||||
|
||||
return(result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user