From 62c20c06e405839d20ef1be7a45c0513780dbe23 Mon Sep 17 00:00:00 2001 From: Elin Waring Date: Tue, 5 Aug 2025 22:03:59 -0400 Subject: [PATCH 1/5] Remove references to the tidyverse progress bar which has been deprecated. --- R/get_url_contents.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/get_url_contents.R b/R/get_url_contents.R index c7fb1df..b7a84db 100644 --- a/R/get_url_contents.R +++ b/R/get_url_contents.R @@ -38,7 +38,7 @@ get_url_contents <- function(links) { grouped_links <- split(links, groups) # Set progress bar - p <- dplyr::progress_estimated(n = length(links)) + # p <- dplyr::progress_estimated(n = length(links)) contents <- grouped_links |> @@ -51,11 +51,11 @@ get_url_contents <- function(links) { p$tick()$print() if (getOption("rrricanes.working_msg")) message("Waiting 10 seconds to retrieve large numbers of links.") - p$pause(10) + # p$pause(10) txt } else { # Send group of links to `download_txt` - p$tick()$print() + # p$tick()$print() download_text(x) } }) From 024199bcb7d892c05ba779ed0b0fd62df229a853 Mon Sep 17 00:00:00 2001 From: Elin Waring Date: Tue, 5 Aug 2025 22:48:23 -0400 Subject: [PATCH 2/5] fix conflicts --- R/get_url_contents.R | 6 ------ 1 file changed, 6 deletions(-) diff --git a/R/get_url_contents.R b/R/get_url_contents.R index b7a84db..8cfbbf3 100644 --- a/R/get_url_contents.R +++ b/R/get_url_contents.R @@ -37,9 +37,6 @@ get_url_contents <- function(links) { groups <- ceiling(seq_along(1:length(links))/80) grouped_links <- split(links, groups) - # Set progress bar - # p <- dplyr::progress_estimated(n = length(links)) - contents <- grouped_links |> purrr::imap(.f = function(x, y) { @@ -48,14 +45,11 @@ get_url_contents <- function(links) { # Send group of links to `download_txt` txt <- download_text(x) # We are not in the last group; apply a delay - p$tick()$print() if (getOption("rrricanes.working_msg")) message("Waiting 10 seconds to retrieve large numbers of links.") - # p$pause(10) txt } else { # Send group of links to `download_txt` - # p$tick()$print() download_text(x) } }) From f06e191de33430d4d10fa1e0c8e68c46c46e39a9 Mon Sep 17 00:00:00 2001 From: Elin Waring Date: Tue, 5 Aug 2025 22:13:15 -0400 Subject: [PATCH 3/5] Sometimes the data are in not
.  Also slice
 usage is slightly different.

---
 R/get_storm_data.R | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/R/get_storm_data.R b/R/get_storm_data.R
index fd3533b..52e6e8c 100644
--- a/R/get_storm_data.R
+++ b/R/get_storm_data.R
@@ -21,17 +21,23 @@ extract_product_contents <- function(links, products) {
     # Otherwise, extract the node from within the HTML and return the text of
     # that node.
   contents <- contents |> purrr::map_chr(.f = function(x) {
+
       txt <- safely_read_html(x)
       if (is.null(txt$result)) {
         x
       } else if (is.null(txt$error)) {
+          xpath_to_use <- ifelse(is.na(rvest::html_node(txt$result, xpath = "//pre")),
+                                 "//table", "//pre")
+        .progress <- FALSE
         txt$result |>
-          rvest::html_node(xpath = "//pre") |>
+          rvest::html_element(xpath = xpath_to_use) |>
           rvest::html_text() |>
           stringr::str_replace_all("\r", "") |>
           stringr::str_to_upper()
       }
     })
+  print(contents)
+  contents
 }
 #' concept for isolating this step
 #' @keywords internal
@@ -130,13 +136,13 @@ get_product <- function(links, products) {
 #' \dontrun{
 #' ## Get public advisories for first storm of 2016 Atlantic season.
 #' #get_storms(year = 2016, basin = "AL") |>
-#'  # dplyr::slice(1) |>
+#'  # dplyr::slice_head(n=1) |>
 #'  # pull(Link) |>
 #'  # get_storm_data( products = "public")
-#' ## Get public advisories and storm discussions for first storm of 2017 
+#' ## Get public advisories and storm discussions for first storm of 2017
 #' Atlantic season.
 #'# get_storms(year = 2017, basin = "AL") |>
-#' #  slice(1) |>
+#' #  slice_head(n=1) |>
 #'  # pull(Link) |>
 #'   # get_storm_data(products = c("discus", "public"))
 #' }
@@ -147,8 +153,8 @@ get_storm_data <- function(links,
                                        "wndprb")) {
 
   products <- match.arg(products, several.ok = TRUE)
- # extract_product_contents(links, products)
-  purrr::map2(links, products, extract_product_contents)
+
+  purrr::map2(links, products, extract_product_contents, .progress = FALSE)
 }
 
 #' @title get_product_links

From 51236573a7901e4a26e392b7b82dc28110e943ec Mon Sep 17 00:00:00 2001
From: Elin Waring 
Date: Wed, 6 Aug 2025 00:42:45 -0400
Subject: [PATCH 4/5] Add collation list to DESCRIPTION. Add terra and remove
 sp from Suggests.

---
 DESCRIPTION | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index b5afc61..0ba2620 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -49,8 +49,31 @@ Suggests:
   rmarkdown,
   rnaturalearthdata (>= 0.1),
   sf (>= 1.0), 
-  sp,
+  terra,
   testthat
 VignetteBuilder: knitr
 Encoding: UTF-8
-RoxygenNote: 7.1.2
+RoxygenNote: 7.3.2
+Collate:
+  'base.R'
+  'data.R'
+  'discus.R'
+  'filters.R'
+  'fstadv.R'
+  'get_storm_data.R'
+  'get_storm_list.R'
+  'get_storms.R'
+  'get_track.R'
+  'get_url_contents.R'
+  'gis.R'
+  'Movement_fstadv.R' 
+  'posest.R' 
+  'prblty.R' 
+  'products.R'
+  'public.R'
+  'scrapers.R'
+  'tidy_fstadv.R'
+  'tracking_chart.R' 
+  'update.R'
+  'utils.R'
+  'wndprb.R' 

From 5a65cce0e0926d6ceb3dcba0744058818157a122 Mon Sep 17 00:00:00 2001
From: Elin Waring 
Date: Wed, 6 Aug 2025 10:55:26 -0400
Subject: [PATCH 5/5] Clean up and also respond to deprecation notices.

---
 R/base.R             | 2 +-
 R/get_storm_data.R   | 5 +----
 R/get_url_contents.R | 7 ++++---
 R/prblty.R           | 2 +-
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/R/base.R b/R/base.R
index 98e4b69..9cc176f 100644
--- a/R/base.R
+++ b/R/base.R
@@ -111,7 +111,7 @@
 #' \code{rrricanes.working_msg} is set to FALSE by default. When TRUE, it will
 #' list the current storm, advisory and date being worked.
 #'
-#' @docType package
+#' @docType _PACKAGE
 #' @name rrricanes
 NULL
 
diff --git a/R/get_storm_data.R b/R/get_storm_data.R
index 52e6e8c..5fe9e1e 100644
--- a/R/get_storm_data.R
+++ b/R/get_storm_data.R
@@ -36,16 +36,13 @@ extract_product_contents <- function(links, products) {
           stringr::str_to_upper()
       }
     })
-  print(contents)
   contents
 }
 #' concept for isolating this step
 #' @keywords internal
 
 parse_product_contents <- function(contents, products){
-  f <- match.fun(products)
-  f(contents)
-  #purrr::map(.x= contents, .f = match.fun(products))
+  purrr::map(.x= contents, .f = match.fun(products))
 }
 
 #' @title extract_storm_links
diff --git a/R/get_url_contents.R b/R/get_url_contents.R
index 8cfbbf3..bfde44e 100644
--- a/R/get_url_contents.R
+++ b/R/get_url_contents.R
@@ -53,7 +53,8 @@ get_url_contents <- function(links) {
         download_text(x)
       }
     })
-  contents <- unsplit(contents, groups)
-contents
-  #purrr::flatten_chr(contents)
+
+    contents <- unsplit(contents, groups)
+    #purrr::list_c(contents)
+    contents
 }
diff --git a/R/prblty.R b/R/prblty.R
index dccc80c..25343f7 100644
--- a/R/prblty.R
+++ b/R/prblty.R
@@ -75,7 +75,7 @@ prblty <- function(contents) {
                                                            .,
                                                            "X",
                                                            "O")))
-print(prblty())
+
     # Convert date
   prblty <- prblty |> dplyr::mutate(
     Date  =