mirror of
https://github.com/dylanbenzi/hurricane_normalization_app.git
synced 2026-07-30 05:08:57 +00:00
add popup information at each point
This commit is contained in:
+77
-11
@@ -284,6 +284,23 @@ storm_track <- reactive({
|
|||||||
# Preprocess the track data with colors
|
# Preprocess the track data with colors
|
||||||
result <- result %>%
|
result <- result %>%
|
||||||
mutate(
|
mutate(
|
||||||
|
hurricane_category = case_when(
|
||||||
|
|
||||||
|
# Hurricane Cat 1
|
||||||
|
windspeed >= 64 & windspeed <= 82 ~ 1,
|
||||||
|
|
||||||
|
# Hurricane Cat 2
|
||||||
|
windspeed >= 83 & windspeed <= 95 ~ 2,
|
||||||
|
|
||||||
|
# Hurricane Cat 3
|
||||||
|
windspeed >= 96 & windspeed <= 112 ~ 3,
|
||||||
|
|
||||||
|
# Hurricane Cat 4
|
||||||
|
windspeed >= 113 & windspeed <= 136 ~ 4,
|
||||||
|
|
||||||
|
# Hurricane Cate 5
|
||||||
|
windspeed >= 137 ~ 5,
|
||||||
|
),
|
||||||
line_color = case_when(
|
line_color = case_when(
|
||||||
|
|
||||||
# Tropical Depression - Green
|
# Tropical Depression - Green
|
||||||
@@ -293,19 +310,19 @@ storm_track <- reactive({
|
|||||||
storm_status == "TS" ~ "#FFED2C",
|
storm_status == "TS" ~ "#FFED2C",
|
||||||
|
|
||||||
# Hurricane Cat 1 - Red
|
# Hurricane Cat 1 - Red
|
||||||
windspeed >= 64 & windspeed <= 82 ~ "#FF4343",
|
hurricane_category == 1 ~ "#FF4343",
|
||||||
|
|
||||||
# Hurricane Cat 2 - Pink
|
# Hurricane Cat 2 - Pink
|
||||||
windspeed >= 83 & windspeed <= 95 ~ "#FF6FFF",
|
hurricane_category == 2 ~ "#FF6FFF",
|
||||||
|
|
||||||
# Hurricane Cat 3 - Magenta
|
# Hurricane Cat 3 - Magenta
|
||||||
windspeed >= 96 & windspeed <= 112 ~ "#FF23D3",
|
hurricane_category == 3 ~ "#FF23D3",
|
||||||
|
|
||||||
# Hurricane Cat 4 - Purple
|
# Hurricane Cat 4 - Purple
|
||||||
windspeed >= 113 & windspeed <= 136 ~ "#C916FF",
|
hurricane_category == 4 ~ "#C916FF",
|
||||||
|
|
||||||
# Hurricane Cate 5 - White
|
# Hurricane Cate 5 - White
|
||||||
windspeed >= 137 ~ "#FFFFFF",
|
hurricane_category == 5 ~ "#FFFFFF",
|
||||||
|
|
||||||
# Extratropical Cyclone
|
# Extratropical Cyclone
|
||||||
storm_status == "EX" ~ "#000000",
|
storm_status == "EX" ~ "#000000",
|
||||||
@@ -329,16 +346,34 @@ storm_track <- reactive({
|
|||||||
TRUE ~ "#CCCCCC"
|
TRUE ~ "#CCCCCC"
|
||||||
),
|
),
|
||||||
line_stroke = case_when(
|
line_stroke = case_when(
|
||||||
|
|
||||||
|
# Add dashed lines for certain storm_status
|
||||||
storm_status == "TD" ~ "0",
|
storm_status == "TD" ~ "0",
|
||||||
storm_status == "TS" ~ "0",
|
storm_status == "TS" ~ "0",
|
||||||
storm_status == "HU" ~ "0",
|
storm_status == "HU" ~ "0",
|
||||||
storm_status == "EX" ~ "0",
|
storm_status == "EX" ~ "0",
|
||||||
storm_status == "SD" ~ "0",
|
storm_status == "SD" ~ "0",
|
||||||
storm_status == "SS" ~ "0",
|
storm_status == "SS" ~ "0",
|
||||||
storm_status == "LO" ~ "5,10",
|
storm_status == "LO" ~ "5,5",
|
||||||
storm_status == "WV" ~ "5,10",
|
storm_status == "WV" ~ "5,5",
|
||||||
storm_status == "DB" ~ "5,10",
|
storm_status == "DB" ~ "5,5",
|
||||||
TRUE ~ "0"
|
TRUE ~ "0"
|
||||||
|
),
|
||||||
|
popup_category = case_when(
|
||||||
|
storm_status == "TD" ~ "TD",
|
||||||
|
storm_status == "TS" ~ "TS",
|
||||||
|
hurricane_category == 1 ~ "H1",
|
||||||
|
hurricane_category == 2 ~ "H2",
|
||||||
|
hurricane_category == 3 ~ "H3",
|
||||||
|
hurricane_category == 4 ~ "H4",
|
||||||
|
hurricane_category == 5 ~ "H5",
|
||||||
|
storm_status == "EX" ~ "EX",
|
||||||
|
storm_status == "SD" ~ "SD",
|
||||||
|
storm_status == "SS" ~ "SS",
|
||||||
|
storm_status == "LO" ~ "LO",
|
||||||
|
storm_status == "WV" ~ "WV",
|
||||||
|
storm_status == "DB" ~ "DB",
|
||||||
|
TRUE ~ "NA"
|
||||||
)
|
)
|
||||||
) %>%
|
) %>%
|
||||||
arrange(datetime)
|
arrange(datetime)
|
||||||
@@ -406,7 +441,14 @@ output$track_map <- renderLeaflet({
|
|||||||
radius = 2,
|
radius = 2,
|
||||||
color = ~line_color,
|
color = ~line_color,
|
||||||
fillOpacity = 1,
|
fillOpacity = 1,
|
||||||
popup = ~storm_status
|
popup = ~paste0("<b>DATE</b>", "<br>",
|
||||||
|
datetime, "<br>",
|
||||||
|
"<b>CATEGORY</b>", "<br>",
|
||||||
|
popup_category, "<br>",
|
||||||
|
"<b>WINDSPEED</b>", "<br>",
|
||||||
|
windspeed, "kt", "<br>",
|
||||||
|
"<b>PRESSURE</b>", "<br>",
|
||||||
|
pressure, "mb")
|
||||||
)
|
)
|
||||||
|
|
||||||
landfall_data <- track_data %>%
|
landfall_data <- track_data %>%
|
||||||
@@ -422,7 +464,19 @@ output$track_map <- renderLeaflet({
|
|||||||
weight = 0,
|
weight = 0,
|
||||||
color = "red",
|
color = "red",
|
||||||
fillColor = "red",
|
fillColor = "red",
|
||||||
fillOpacity = 1
|
fillOpacity = 1,
|
||||||
|
popup = ~paste0("<b>LANDFALL</b>", "<br>",
|
||||||
|
"<b>DATE</b>", "<br>",
|
||||||
|
datetime, "<br>",
|
||||||
|
"<b>CATEGORY</b>", "<br>",
|
||||||
|
popup_category, "<br>",
|
||||||
|
"<b>WINDSPEED</b>", "<br>",
|
||||||
|
windspeed, "kt", "<br>",
|
||||||
|
"<b>PRESSURE</b>", "<br>",
|
||||||
|
pressure, "mb", "<br>",
|
||||||
|
"<b>RMW</b>", "<br>",
|
||||||
|
rmw, "nm"
|
||||||
|
)
|
||||||
) %>%
|
) %>%
|
||||||
addCircles(
|
addCircles(
|
||||||
data = landfall_data,
|
data = landfall_data,
|
||||||
@@ -432,7 +486,19 @@ output$track_map <- renderLeaflet({
|
|||||||
weight = 2,
|
weight = 2,
|
||||||
color = "red",
|
color = "red",
|
||||||
fillColor = "red",
|
fillColor = "red",
|
||||||
fillOpacity = 0.3
|
fillOpacity = 0.3,
|
||||||
|
popup = ~paste0("<b>LANDFALL</b>", "<br>",
|
||||||
|
"<b>DATE</b>", "<br>",
|
||||||
|
datetime, "<br>",
|
||||||
|
"<b>CATEGORY</b>", "<br>",
|
||||||
|
popup_category, "<br>",
|
||||||
|
"<b>WINDSPEED</b>", "<br>",
|
||||||
|
windspeed, "kt", "<br>",
|
||||||
|
"<b>PRESSURE</b>", "<br>",
|
||||||
|
pressure, "mb", "<br>",
|
||||||
|
"<b>RMW</b>", "<br>",
|
||||||
|
rmw, "nm"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user