{{arguments$key}}

# Find names of relevant datasets
ds <- grep(sprintf("^%s.", arguments$key), names(gis), ignore.case = TRUE, 
                   value = TRUE)
# Get previous track points
points <- as_data_frame(gis[[ds[grep(sprintf("%s_pts", arguments$key), 
                                     ds, ignore.case = TRUE)]]])
# Convert points$STORMTYPE to factor
points$STORMTYPE <- factor(points$STORMTYPE, 
                           levels = c("DB", "LO", "TD", "TS", "HU", "MH"), 
                           labels = c("Disturbance", "Low", 
                                      "Tropical Depression", "Tropical Storm", 
                                      "Hurricane", "Major Hurricane"))

plot_points <- geom_point(data = points, aes(x = LON, y = LAT, size = STORMTYPE))
# Get forecast track points
fcst_points <- as_data_frame(gis[[ds[grep(sprintf("%s.+_5day_pts", 
                                                  arguments$key), ds, 
                                          ignore.case = TRUE)]]])


# Convert points$STORMTYPE to factor
fcst_points$STORMTYPE <- factor(fcst_points$STORMTYPE, 
                           levels = c("DB", "LO", "TD", "TS", "HU", "MH"), 
                           labels = c("Disturbance", "Low", 
                                      "Tropical Depression", "Tropical Storm", 
                                      "Hurricane", "Major Hurricane"))

plot_fcst_points <- geom_point(data = fcst_points, 
                               aes(x = LON, y = LAT, size = STORMTYPE))
tracking_chart(color = "black", fill = "white", size = 0.1, res = 50) + 
  plot_points + 
  plot_fcst_points + 
  theme(legend.position = "bottom", 
        legend.box = "vertical")


timtrice/rrricanes documentation built on Oct. 11, 2023, 2:25 a.m.