diff --git a/.Rbuildignore b/.Rbuildignore index cde4010e..7dfcc805 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -4,18 +4,18 @@ ^\.Rproj\.user$ ^\.rstudio$ ^_pkgdown\.yml$ +^doc$ ^docker$ ^CHANGELOG\.md$ +^codecov.yml$ ^data-raw$ ^datasets/ ^deploy\.sh$ -^docs$ +^Meta$ ^NEWS\.md$ ^README\.Rmd$ ^reports$ ^rrricanes\.code-workspace -^doc$ -^Meta$ ^vignettes/accumulated_cyclone_energy.Rmd$ ^vignettes/forecast_advisory.Rmd$ ^vignettes/probabilistic_storm_surge.Rmd$ diff --git a/.gitignore b/.gitignore index ead3bb16..d2a68605 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,6 @@ datasets inst/doc rrricanes.code-workspace rrricanes.Rcheck -rrricanes.wiki/ doc +docs Meta diff --git a/CHANGELOG.md b/CHANGELOG.md index e81148e0..051a3593 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,16 +14,22 @@ project adheres to [Semantic Versioning](http://semver.org/). - `get_storm_list` returns dataframe of all known cyclones. (#114) ### Changed - - `gis_download` and `gis_latest` can accept parameters for rgdal::readOGR - (#104). + - `gis_latest` can accept parameters for rgdal::readOGR (#104). + - `gis_download` modified to download zip files and extract contents + returning a vector of files within the zip. + - `ep_prblty_stations` now returns all stations. - `al_prblty_stations`, `cp_prblty_stations` and `ep_prblty_stations` datasets were modified with additional columns. Changes are documented. ### Removed - - NA + - `tracking_chart`, `al_tracking_chart`, and `ep_tracking_chart` all removed + in favor of using `rnaturalearth` and associated data packages, or other + mapping packages. + + - `shp_to_df` removed; users can use `sf::st_read` ### Deprecated - NA diff --git a/DESCRIPTION b/DESCRIPTION index 3b71c2ac..269863a9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -42,10 +42,15 @@ Imports: Suggests: covr, devtools, + gganimate, + HURDAT, knitr, + magick, rmarkdown, + rnaturalearthhires, + rrricanesdata, + scales, sf, - sp, testthat RoxygenNote: 6.1.1 VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index 192ac9ed..fd0ec5a2 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,10 +1,8 @@ # Generated by roxygen2: do not edit by hand export(al_prblty_stations) -export(al_tracking_chart) export(cp_prblty_stations) export(ep_prblty_stations) -export(ep_tracking_chart) export(get_discus) export(get_fstadv) export(get_ftp_storm_data) @@ -29,14 +27,12 @@ export(knots_to_mph) export(mb_to_in) export(nm_to_sm) export(saffir) -export(shp_to_df) export(status_abbr_to_str) export(tidy_adv) export(tidy_fcst) export(tidy_fcst_wr) export(tidy_fstadv) export(tidy_wr) -export(tracking_chart) export(twoal) export(twoep) importFrom(magrittr,"%>%") diff --git a/NEWS.md b/NEWS.md index eb64e3ed..05ca3939 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,14 +14,19 @@ rrricanes Unreleased (yyyy-mm-dd) * Allow parameters for rgdal::readOGR (#104) -* Add `tidy_adv` to replace `tidy_fstadv`; `tidy_fstadv` will be removed in - release 0.2.2 (#103) +* Add `tidy_adv` to replace `tidy_fstadv`; `tidy_fstadv` will be removed in release 0.2.2 (#103) * `al_prblty_stations` and `cp_prblty_stations` updated to accomodate new dataset. (#46) * `ep_prblty_stations` now returns dataset of east Pacific stations. (#46) +* `tracking_chart` and associated functions have been removed in favor of rnaturalearth and related packages. See `vignette("gis_data", package = "rrricanes") for details. + +* `gis_download` no longer reads in the shapefiles; only downloads and extracts the zip files. + +* `shp_to_df` also removed in favor of built-in `sf` and `ggplot2` functions. + ### BUG FIXES * `tidy_fcst` only returned forecasts for hours 12:96. Now returns 120. (#107) diff --git a/R/base.R b/R/base.R index d69af7d7..4035f7fa 100755 --- a/R/base.R +++ b/R/base.R @@ -54,9 +54,7 @@ #' To install \code{rrricanesdata}, run #' #' \code{ -#' install.packages("rrricanesdata", -#' repos = "https://timtrice.github.io/drat/", -#' type = "source") +#' remotes::install_github("ropensci/rrricanesdata") #' } #' #' See \code{vignette("installing_rrricanesdata", package = "rrricanes")} for @@ -83,11 +81,6 @@ #' \code{\link{gis_download}} will download the datasets from the above #' functions. #' -#' Some GIS datasets will need to be converted to dataframes to plot geoms. Use -#' \code{\link{shp_to_df}} to convert SpatialLinesDataFrames and -#' SpatialPolygonsDataFrames. SpatialPointsDataFrames can be converted using -#' \code{tibble::as_data_frame} targeting the @data object. -#' #' @section Package Options: #' #' \code{dplyr.show_progress} displays the dplyr progress bar when scraping raw @@ -141,13 +134,15 @@ hasData <- function(has_data = .pkgenv$has_data) { } } -utils::globalVariables(c("Date", "Hour", "Minute", "Lat", "LatHemi", "Lon", - "LonHemi", "Wind", "Gust", "Month", "Year", "FcstDate", - "WindField34", "WindField50", "WindField64", "lat", - "long", "group", ".", "NW34", "name", "data", "Basin", - stringr::str_c(c("NE", "SE", "SW", "NW", "64")), - stringr::str_c(c("NE", "SE", "SW", "NW", "50")), - stringr::str_c(c("NE", "SE", "SW", "NW", "34")))) +utils::globalVariables(c( + "Date", "Hour", "Minute", "Lat", "LatHemi", "Lon", + "LonHemi", "Wind", "Gust", "Month", "Year", "FcstDate", + "WindField34", "WindField50", "WindField64", "lat", + "long", "group", ".", "NW34", "name", "data", "Basin", + stringr::str_c(c("NE", "SE", "SW", "NW", "64")), + stringr::str_c(c("NE", "SE", "SW", "NW", "50")), + stringr::str_c(c("NE", "SE", "SW", "NW", "34")) +)) #' @title extract_year_archive_link #' @description Extracts the year from the archive link. @@ -156,7 +151,7 @@ utils::globalVariables(c("Date", "Hour", "Minute", "Lat", "LatHemi", "Lon", #' @keywords internal extract_year_archive_link <- function(link) { # Year is listed in link towards the end surrounded by slashes. - as.numeric(stringr::str_match(link, '/([:digit:]{4})/')[,2]) + as.numeric(stringr::str_match(link, "/([:digit:]{4})/")[, 2]) } #' @title get_url_contents @@ -167,7 +162,6 @@ extract_year_archive_link <- function(link) { #' @param link URL to download #' @keywords internal get_url_contents <- function(links) { - download_text <- function(grouped_links) { # Create a new Async object with `grouped_links` @@ -177,21 +171,24 @@ get_url_contents <- function(links) { results <- grouped_links$get() # Do we have any bad `grouped_links`? - bad_results_ind <- which(purrr::map(results, ~.$success()) == FALSE) + bad_results_ind <- which(purrr::map(results, ~ .$success()) == FALSE) if (length(bad_results_ind) > 0) { - warning(sprintf("URL %s was unsuccesful.\n", - purrr::map(results[bad_results_ind], ~.$url)), - call. = FALSE) + warning(sprintf( + "URL %s was unsuccesful.\n", + purrr::map(results[bad_results_ind], ~ .$url) + ), + call. = FALSE + ) # Remove bad `grouped_links` results <- results[-bad_results_ind] } - purrr::map_chr(results, ~.$parse("UTF-8")) + purrr::map_chr(results, ~ .$parse("UTF-8")) } # Create groups of links divisible by 80. We are to allow no more than 80 # requests every 10 seconds. If length of `link` is less than 80, then will # only have one group and should have no delay. - groups <- ceiling(seq_along(1:length(links))/80) + groups <- ceiling(seq_along(1:length(links)) / 80) links <- split(links, groups) # Set progress bar @@ -200,14 +197,14 @@ get_url_contents <- function(links) { contents <- links %>% purrr::imap(.f = function(x, y) { - if (as.numeric(y) != length(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")) + if (getOption("rrricanes.working_msg")) { message("Waiting 10 seconds to retrieve large numbers of links.") + } p$pause(10) txt } else { @@ -218,7 +215,6 @@ get_url_contents <- function(links) { }) purrr::flatten_chr(contents) - } #' @title get_nhc_link @@ -228,8 +224,9 @@ get_url_contents <- function(links) { #' @param protocol https or http #' @keywords internal get_nhc_link <- function(withTrailingSlash = TRUE, protocol = "https") { - if (withTrailingSlash) + if (withTrailingSlash) { return(sprintf("%s://www.nhc.noaa.gov/", protocol)) + } sprintf("%s://www.nhc.noaa.gov", protocol) } @@ -238,8 +235,9 @@ get_nhc_link <- function(withTrailingSlash = TRUE, protocol = "https") { #' @inheritParams get_nhc_link #' @keywords internal get_nhc_ftp_link <- function(withTrailingSlash = TRUE) { - if (withTrailingSlash) + if (withTrailingSlash) { return("ftp://ftp.nhc.noaa.gov/") + } "ftp://ftp.nhc.noaa.gov" } @@ -272,8 +270,9 @@ mb_to_in <- function(x) { #' @keywords internal month_str_to_num <- function(m) { abbr <- which(month.abb == stringr::str_to_title(m)) - if (purrr::is_empty(abbr)) + if (purrr::is_empty(abbr)) { stop(sprintf("%s is not a valid month abbreviation.", m)) + } abbr } diff --git a/R/discus.R b/R/discus.R index 30a72675..02500649 100644 --- a/R/discus.R +++ b/R/discus.R @@ -30,7 +30,6 @@ get_discus <- function(links) { #' @seealso \code{\link{get_discus}} #' @keywords internal discus <- function(contents) { - status <- scrape_header( contents = contents, # The "SPECIAL" pattern has to be left here; moving it under @@ -43,12 +42,11 @@ discus <- function(contents) { key <- scrape_key(contents) tibble::tibble( - Status = status[,1], - Name = status[,2], - Adv = as.numeric(status[,3]), + Status = status[, 1], + Name = status[, 2], + Adv = as.numeric(status[, 3]), Date = issue_date, Key = key, Contents = contents ) - } diff --git a/R/filters.R b/R/filters.R index 9b65d1f5..e3f13098 100644 --- a/R/filters.R +++ b/R/filters.R @@ -41,8 +41,9 @@ filter_posest <- function(links) { #' @keywords internal filter_public <- function(links) { grep("/pub/P(AL|EP)|/pub/PA(AL|EP)|/pub/PB(AL|EP)|public", - x = links, - value = TRUE) + x = links, + value = TRUE + ) } #' @title filter_prblty diff --git a/R/fstadv.R b/R/fstadv.R index 6c319a14..e6581693 100644 --- a/R/fstadv.R +++ b/R/fstadv.R @@ -89,7 +89,6 @@ get_fstadv <- function(links) { #' @param contents URL of a specific FORECAST/ADVISORY product #' @keywords internal fstadv <- function(contents) { - status <- scrape_header( contents = contents, # The "SPECIAL" pattern has to be left here; moving it under @@ -108,29 +107,28 @@ fstadv <- function(contents) { wind_radius <- fstadv_wind_radius(contents) prev_pos <- fstadv_prev_pos(contents, issue_date) seas <- fstadv_seas(contents) - forecasts <- fstadv_forecasts(contents, key, status[,3], issue_date) + forecasts <- fstadv_forecasts(contents, key, status[, 3], issue_date) tibble::tibble( - Status = status[,1], - Name = status[,2], - Adv = as.numeric(status[,3]), + Status = status[, 1], + Name = status[, 2], + Adv = as.numeric(status[, 3]), Date = issue_date, Key = key, - Lat = lat_lon[,1], - Lon = lat_lon[,2], - Wind = winds_gusts[,1], - Gust = winds_gusts[,2], + Lat = lat_lon[, 1], + Lon = lat_lon[, 2], + Wind = winds_gusts[, 1], + Gust = winds_gusts[, 2], Pressure = pressure, PosAcc = posacc, - FwdDir = fwd_mvmt[,1], - FwdSpeed = fwd_mvmt[,2], + FwdDir = fwd_mvmt[, 1], + FwdSpeed = fwd_mvmt[, 2], Eye = eye, Seas = seas, WindRadius = wind_radius, Forecast = forecasts ) %>% tidyr::unnest() - } #' @title fstadv_eye @@ -139,10 +137,12 @@ fstadv <- function(contents) { #' @return numeric #' @keywords internal fstadv_eye <- function(contents) { - ptn <- stringr::str_c('EYE DIAMETER[ ]+', - '([0-9]{2,3})', # Eye diameter, integer - '[ ]+NM') - as.numeric(stringr::str_match(contents, ptn)[,2]) + ptn <- stringr::str_c( + "EYE DIAMETER[ ]+", + "([0-9]{2,3})", # Eye diameter, integer + "[ ]+NM" + ) + as.numeric(stringr::str_match(contents, ptn)[, 2]) } #' @title fstadv_fcst @@ -162,7 +162,6 @@ fstadv_forecasts <- function(content, key, adv, adv_date) { # prefix, eliminate some vars where necessary, and return a filtered # dataframe. rebuild_forecasts <- function(hr, df) { - df <- df %>% dplyr::filter(.data$FcstPeriod == hr) %>% @@ -199,34 +198,35 @@ fstadv_forecasts <- function(content, key, adv, adv_date) { } else { df } - } - ptn <- stringr::str_c("([:digit:]{2})/([:digit:]{2})([:digit:]{2})Z", - "[:blank:]+([:digit:]{1,2}\\.[:digit:])([N|S])", - "[:blank:]+([:digit:]{1,3}\\.[:digit:]{1})([E|W])", - "[[:space:][:punct:][:alpha:]]+", - "MAX WIND[:blank:]+([:digit:]{1,3})[:blank:]*KT", - "[[:blank:][:punct:]]+GUSTS[:blank:]+", - "([:digit:]{1,3})[:blank:]*KT[[:space:][:punct:]]+", - "(?:64 KT[[:blank:][:punct:]]+", - "([:digit:]{1,3})NE", - "[:blank:]+([:digit:]{1,3})SE", - "[:blank:]+([:digit:]{1,3})SW", - "[:blank:]+([:digit:]{1,3})NW", - "[[:punct:][:space:]]+)?", - "(?:50 KT[[:blank:][:punct:]]+", - "([:digit:]{1,3})NE", - "[:blank:]+([:digit:]{1,3})SE", - "[:blank:]+([:digit:]{1,3})SW", - "[:blank:]+([:digit:]{1,3})NW", - "[[:punct:][:space:]]+)?", - "(?:34 KT[[:blank:][:punct:]]+", - "([:digit:]{1,3})NE", - "[:blank:]+([:digit:]{1,3})SE", - "[:blank:]+([:digit:]{1,3})SW", - "[:blank:]+([:digit:]{1,3})NW", - "[[:punct:][:space:]]+)?") + ptn <- stringr::str_c( + "([:digit:]{2})/([:digit:]{2})([:digit:]{2})Z", + "[:blank:]+([:digit:]{1,2}\\.[:digit:])([N|S])", + "[:blank:]+([:digit:]{1,3}\\.[:digit:]{1})([E|W])", + "[[:space:][:punct:][:alpha:]]+", + "MAX WIND[:blank:]+([:digit:]{1,3})[:blank:]*KT", + "[[:blank:][:punct:]]+GUSTS[:blank:]+", + "([:digit:]{1,3})[:blank:]*KT[[:space:][:punct:]]+", + "(?:64 KT[[:blank:][:punct:]]+", + "([:digit:]{1,3})NE", + "[:blank:]+([:digit:]{1,3})SE", + "[:blank:]+([:digit:]{1,3})SW", + "[:blank:]+([:digit:]{1,3})NW", + "[[:punct:][:space:]]+)?", + "(?:50 KT[[:blank:][:punct:]]+", + "([:digit:]{1,3})NE", + "[:blank:]+([:digit:]{1,3})SE", + "[:blank:]+([:digit:]{1,3})SW", + "[:blank:]+([:digit:]{1,3})NW", + "[[:punct:][:space:]]+)?", + "(?:34 KT[[:blank:][:punct:]]+", + "([:digit:]{1,3})NE", + "[:blank:]+([:digit:]{1,3})SE", + "[:blank:]+([:digit:]{1,3})SW", + "[:blank:]+([:digit:]{1,3})NW", + "[[:punct:][:space:]]+)?" + ) quads <- c("NE", "SE", "SW", "NW") @@ -241,17 +241,21 @@ fstadv_forecasts <- function(content, key, adv, adv_date) { # purrr::map(`[`, , 2:22) %>% # If any storm has 0 forecasts (i.e., the list element is empty), populate # all columns with NA - purrr::modify_if(.p = purrr::is_empty, - .f = ~matrix(data = NA_character_, ncol = 22)) %>% + purrr::modify_if( + .p = purrr::is_empty, + .f = ~ matrix(data = NA_character_, ncol = 22) + ) %>% # Convert to tibble cause God I hate working with lists like this though I # know I need the practice... purrr::map(tibble::as_tibble) %>% - purrr::map(rlang::set_names, - nm = c("String", "Date", "Hour", "Minute", - "Lat", "LatHemi", "Lon", "LonHemi", - "Wind", "Gust", stringr::str_c(quads, "64"), - stringr::str_c(quads, "50"), - stringr::str_c(quads, "34"))) + purrr::map( + rlang::set_names, + nm = c( + "String", "Date", "Hour", "Minute", "Lat", "LatHemi", "Lon", "LonHemi", + "Wind", "Gust", stringr::str_c(quads, "64"), + stringr::str_c(quads, "50"), stringr::str_c(quads, "34") + ) + ) forecast_periods <- c(12, 24, 36, 48, 72, 96, 120) @@ -281,11 +285,11 @@ fstadv_forecasts <- function(content, key, adv, adv_date) { FcstPeriod = forecast_periods[1:dplyr::n()], FcstMonth = dplyr::case_when( as.numeric(.data$Date) < lubridate::day(.data$AdvDate) ~ lubridate::month(.data$AdvDate) + 1, - TRUE ~ lubridate::month(.data$AdvDate) + TRUE ~ lubridate::month(.data$AdvDate) ), FcstYear = dplyr::case_when( FcstMonth < lubridate::month(.data$AdvDate) ~ lubridate::year(.data$AdvDate) + 1, - TRUE ~ lubridate::year(.data$AdvDate) + TRUE ~ lubridate::year(.data$AdvDate) ), FcstDate = lubridate::ymd_hms( strftime( @@ -300,12 +304,12 @@ fstadv_forecasts <- function(content, key, adv, adv_date) { # If Lat is in southern hemisphere (unlikely, but possible), make negative Lat = dplyr::case_when( LatHemi == "S" ~ as.numeric(.data$Lat) * -1, - TRUE ~ as.numeric(.data$Lat) + TRUE ~ as.numeric(.data$Lat) ), # If Lon in western hemisphere (most likely), make negative. Lon = dplyr::case_when( LonHemi == "W" ~ as.numeric(.data$Lon) * -1, - TRUE ~ as.numeric(.data$Lon) + TRUE ~ as.numeric(.data$Lon) ) ) %>% # Make Wind, Gust, relative wind/gust vars and sea vars all numeric @@ -317,7 +321,8 @@ fstadv_forecasts <- function(content, key, adv, adv_date) { df <- df %>% dplyr::left_join( - rebuild_forecasts(hr, df = df_forecasts), by = c("Key", "Adv") + rebuild_forecasts(hr, df = df_forecasts), + by = c("Key", "Adv") ) } @@ -325,7 +330,6 @@ fstadv_forecasts <- function(content, key, adv, adv_date) { dplyr::ungroup() %>% dplyr::select(-c(.data$Key, .data$Adv)) %>% split(seq(nrow(.))) - } #' @title fstadv_fwd_mvmt @@ -340,14 +344,14 @@ fstadv_forecasts <- function(content, key, adv, adv_date) { #' @return numeric #' @keywords internal fstadv_fwd_mvmt <- function(contents, what = NULL) { - - ptn <- stringr::str_c("PRESENT MOVEMENT TOWARD[[:alpha:][:punct:][:space:]]+", - "([:digit:]{1,3})[:blank:]+DEGREES AT[:blank:]+", - "([:digit:]{1,3})[:blank:]KT") + ptn <- stringr::str_c( + "PRESENT MOVEMENT TOWARD[[:alpha:][:punct:][:space:]]+", + "([:digit:]{1,3})[:blank:]+DEGREES AT[:blank:]+", + "([:digit:]{1,3})[:blank:]KT" + ) matches <- stringr::str_match(contents, ptn) - matrix(data = c(as.numeric(matches[,2]), as.numeric(matches[,3])), ncol = 2L) - + matrix(data = c(as.numeric(matches[, 2]), as.numeric(matches[, 3])), ncol = 2L) } #' @title fstadv_pos_accuracy() @@ -357,7 +361,7 @@ fstadv_fwd_mvmt <- function(contents, what = NULL) { #' @keywords internal fstadv_pos_accuracy <- function(contents) { ptn <- stringr::str_c("POSITION ACCURATE WITHIN[:blank:]+([0-9]{2,3})[:blank:]+NM") - as.numeric(stringr::str_match(contents, ptn)[,2]) + as.numeric(stringr::str_match(contents, ptn)[, 2]) } #' @title fstadv_pressure @@ -367,30 +371,40 @@ fstadv_pos_accuracy <- function(contents) { #' @return numeric #' @keywords internal fstadv_pressure <- function(contents) { - ptn <- stringr::str_c("MINIMUM CENTRAL PRESSURE[:blank:]+", - "([:digit:]{3,4})[:blank:]*MB") - as.numeric(stringr::str_match(contents, ptn)[,2]) + ptn <- stringr::str_c( + "MINIMUM CENTRAL PRESSURE[:blank:]+", + "([:digit:]{3,4})[:blank:]*MB" + ) + as.numeric(stringr::str_match(contents, ptn)[, 2]) } #' @title fstadv_prev_pos #' @description Get storm's previous position #' @keywords internal fstadv_prev_pos <- function(contents, adv_date) { - ptn <- "AT \\d\\d/\\d{4}Z CENTER WAS LOCATED NEAR (\\d\\d\\.\\d)(\\w)\\s+(\\d{1,3}\\.\\d)(\\w)" - matches <- stringr::str_match(contents, ptn)[,2:5] + + matches <- stringr::str_match(contents, ptn)[, 2:5] prev_pos_date <- adv_date - lubridate::hours(3) - prev_pos_lat <- ifelse(matches[,2] == "S", - as.numeric(matches[,1]) * -1, - as.numeric(matches[,1])) - prev_pos_lon <- ifelse(matches[,4] == "W", - as.numeric(matches[,3]) * -1, - as.numeric(matches[,3])) + + prev_pos_lat <- ifelse( + matches[, 2] == "S", + as.numeric(matches[, 1]) * -1, + as.numeric(matches[, 1]) + ) + + prev_pos_lon <- ifelse( + matches[, 4] == "W", + as.numeric(matches[, 3]) * -1, + as.numeric(matches[, 3]) + ) + tibble::tibble( PrevPosDate = prev_pos_date, PrevPosLat = prev_pos_lat, - PrevPosLon = prev_pos_lon) %>% + PrevPosLon = prev_pos_lon + ) %>% split(seq(nrow(.))) } @@ -404,23 +418,28 @@ fstadv_prev_pos <- function(contents, adv_date) { #' @return numeric #' @keywords internal fstadv_lat_lon <- function(contents) { - - ptn <- stringr::str_c("[CENTER LOCATED | DISSIPATING] NEAR[:blank:]+", - "([0-9\\.]{3,4})", # Latitude can be 9.9N or 99.9N - "([N|S]{1})", # Northern meisphere - "[:blank:]+([0-9\\.]{4,5})", #Longitude can be 0 to 180 - "([E|W]){1}", # Hemisphere - "[:blank:]+") + ptn <- stringr::str_c( + "[CENTER LOCATED | DISSIPATING] NEAR[:blank:]+", + "([0-9\\.]{3,4})", # Latitude can be 9.9N or 99.9N + "([N|S]{1})", # Northern meisphere + "[:blank:]+([0-9\\.]{4,5})", # Longitude can be 0 to 180 + "([E|W]){1}", # Hemisphere + "[:blank:]+" + ) matches <- stringr::str_match(contents, ptn) - lat <- ifelse(matches[, 3] == "S", - as.numeric(matches[, 2]) * -1, - as.numeric(matches[, 2]) * 1) + lat <- ifelse( + matches[, 3] == "S", + as.numeric(matches[, 2]) * -1, + as.numeric(matches[, 2]) * 1 + ) - lon <- ifelse(matches[, 5] == "W", - as.numeric(matches[, 4]) * -1, - as.numeric(matches[, 4]) * 1) + lon <- ifelse( + matches[, 5] == "W", + as.numeric(matches[, 4]) * -1, + as.numeric(matches[, 4]) * 1 + ) matrix(data = c(lat, lon), ncol = 2) } @@ -434,13 +453,15 @@ fstadv_lat_lon <- function(contents) { fstadv_seas <- function(content) { # 12 FT SEAS..125NE 90SE 90SW 175NW. - ptn <- stringr::str_c("12 FT SEAS", - "[[:punct:][:blank:]]+([0-9]{1,3})NE", - "[:blank:]+([0-9]{1,3})SE", - "[:blank:]+([0-9]{1,3})SW", - "[:blank:]+([0-9]{1,3})NW") + ptn <- stringr::str_c( + "12 FT SEAS", + "[[:punct:][:blank:]]+([0-9]{1,3})NE", + "[:blank:]+([0-9]{1,3})SE", + "[:blank:]+([0-9]{1,3})SW", + "[:blank:]+([0-9]{1,3})NW" + ) - stringr::str_match(content, ptn)[,2:5] %>% + stringr::str_match(content, ptn)[, 2:5] %>% apply(MARGIN = 2L, FUN = as.numeric) %>% tibble::as_tibble() %>% rlang::set_names(nm = stringr::str_c("Seas", c("NE", "SE", "SW", "NW"))) %>% @@ -461,32 +482,35 @@ fstadv_seas <- function(content) { #' @return dataframe #' @keywords internal fstadv_wind_radius <- function(content) { + ptn <- stringr::str_c( + "MAX SUSTAINED WINDS[:blank:]+[:digit:]{1,3} KT ", + "WITH GUSTS TO[:blank:]+[:digit:]{1,3} ", + "KT[[:punct:][:space:][:upper:]]+", + "(?:(64) KT[[:blank:][:punct:]]+([:digit:]{1,3})", + "NE[:blank:]+([:digit:]{1,3})", + "SE[:blank:]+([:digit:]{1,3})", + "SW[:blank:]+([:digit:]{1,3})", + "NW[[:punct:][:space:]]+)?", + "(?:(50) KT[[:blank:][:punct:]]+([:digit:]{1,3})", + "NE[:blank:]+([:digit:]{1,3})", + "SE[:blank:]+([:digit:]{1,3})", + "SW[:blank:]+([:digit:]{1,3})", + "NW[[:punct:][:space:]]+)?", + "(?:(34) KT[[:blank:][:punct:]]+([:digit:]{1,3})", + "NE[:blank:]+([:digit:]{1,3})", + "SE[:blank:]+([:digit:]{1,3})", + "SW[:blank:]+([:digit:]{1,3})", + "NW[[:punct:][:space:]]+)?" + ) - ptn <- stringr::str_c("MAX SUSTAINED WINDS[:blank:]+[:digit:]{1,3} KT ", - "WITH GUSTS TO[:blank:]+[:digit:]{1,3} ", - "KT[[:punct:][:space:][:upper:]]+", - "(?:(64) KT[[:blank:][:punct:]]+([:digit:]{1,3})", - "NE[:blank:]+([:digit:]{1,3})", - "SE[:blank:]+([:digit:]{1,3})", - "SW[:blank:]+([:digit:]{1,3})", - "NW[[:punct:][:space:]]+)?", - "(?:(50) KT[[:blank:][:punct:]]+([:digit:]{1,3})", - "NE[:blank:]+([:digit:]{1,3})", - "SE[:blank:]+([:digit:]{1,3})", - "SW[:blank:]+([:digit:]{1,3})", - "NW[[:punct:][:space:]]+)?", - "(?:(34) KT[[:blank:][:punct:]]+([:digit:]{1,3})", - "NE[:blank:]+([:digit:]{1,3})", - "SE[:blank:]+([:digit:]{1,3})", - "SW[:blank:]+([:digit:]{1,3})", - "NW[[:punct:][:space:]]+)?") - - stringr::str_match(content, ptn)[,2:16] %>% + stringr::str_match(content, ptn)[, 2:16] %>% apply(MARGIN = 2L, FUN = as.numeric) %>% tibble::as_tibble() %>% - rlang::set_names(nm = c("WindField64", "NE64", "SE64", "SW64", "NW64", - "WindField50", "NE50", "SE50", "SW50", "NW50", - "WindField34", "NE34", "SE34", "SW34", "NW34")) %>% + rlang::set_names(nm = c( + "WindField64", "NE64", "SE64", "SW64", "NW64", + "WindField50", "NE50", "SE50", "SW50", "NW50", + "WindField34", "NE34", "SE34", "SW34", "NW34" + )) %>% dplyr::select(-tidyselect::starts_with("WindField")) %>% split(seq(nrow(.))) } @@ -497,17 +521,17 @@ fstadv_wind_radius <- function(content) { #' @return numeric #' @keywords internal fstadv_winds_gusts <- function(contents) { - - ptn <- stringr::str_c('MAX SUSTAINED WINDS[ ]+', - '([0-9]{2,3})', # Winds - '[ ]+KT WITH GUSTS TO[ ]+', - '([0-9]{2,3})', # Gusts - '[ ]+KT') + ptn <- stringr::str_c( + "MAX SUSTAINED WINDS[ ]+", + "([0-9]{2,3})", # Winds + "[ ]+KT WITH GUSTS TO[ ]+", + "([0-9]{2,3})", # Gusts + "[ ]+KT" + ) matches <- stringr::str_match(contents, ptn) - matrix(data = c(as.numeric(matches[,2]), as.numeric(matches[,3])), ncol = 2L) - + matrix(data = c(as.numeric(matches[, 2]), as.numeric(matches[, 3])), ncol = 2L) } #' @title tidy_adv @@ -542,15 +566,19 @@ fstadv_winds_gusts <- function(contents) { #' } #' @export tidy_adv <- function(df) { - if (!is.data.frame(df)) + if (!is.data.frame(df)) { stop("Expecting a dataframe.") + } + df <- df %>% dplyr::select( "Key", .data$Adv:.data$Date, .data$Status:.data$Name, .data$Lat:.data$Eye, - dplyr::starts_with("Seas")) + dplyr::starts_with("Seas") + ) + return(df) } @@ -560,7 +588,9 @@ tidy_adv <- function(df) { #' @export tidy_fstadv <- function(df) { .Deprecated("tidy_adv", - msg = "`tidy_fstadv is deprecated and will be removed in v0.2.2") + msg = "`tidy_fstadv is deprecated and will be removed in v0.2.2" + ) + tidy_adv(df) } @@ -586,8 +616,9 @@ tidy_fstadv <- function(df) { #' } #' @export tidy_wr <- function(df) { - if (!is.data.frame(df)) + if (!is.data.frame(df)) { stop("Expecting a dataframe.") + } # Collapse wind radius fields to narrow dataframe then expand on the four # quadrants, keeping WindField as a variable. @@ -605,9 +636,11 @@ tidy_wr <- function(df) { "NE" = paste0("NE", y), "SE" = paste0("SE", y), "SW" = paste0("SW", y), - "NW" = paste0("NW", y)) %>% + "NW" = paste0("NW", y) + ) %>% dplyr::mutate("WindField" = y) - }) %>% + } + ) %>% dplyr::select(c( "Key", "Adv", "Date", "WindField", .data$NE:.data$NW )) %>% @@ -615,7 +648,7 @@ tidy_wr <- function(df) { dplyr::arrange(.data$Key, .data$Date, .data$Adv, .data$WindField) # Remove NA rows for windfield quadrants - wr <- wr[stats::complete.cases(wr$NE, wr$SE, wr$SW, wr$NW),] + wr <- wr[stats::complete.cases(wr$NE, wr$SE, wr$SW, wr$NW), ] return(wr) } @@ -644,8 +677,9 @@ tidy_wr <- function(df) { #' } #' @export tidy_fcst <- function(df) { - if (!is.data.frame(df)) + if (!is.data.frame(df)) { stop("Expecting a dataframe.") + } # Build forecasts dataframe with base data for each forecast position. This # does not include wind radius data; that comes next. This will be similar @@ -659,7 +693,7 @@ tidy_fcst <- function(df) { # #107 Modified regex pattern to look for Hr120, as well. fcst_periods <- as.list(names(df)) %>% stringr::str_match(pattern = "Hr([:digit:]{2,3})FcstDate") %>% - .[,2] %>% + .[, 2] %>% .[!rlang::are_na(.)] %>% as.numeric() @@ -668,18 +702,26 @@ tidy_fcst <- function(df) { .f = function(y) { df %>% dplyr::select(c("Key", "Adv", "Date", paste0("Hr", y, v))) %>% - dplyr::rename("Key" = "Key", "Adv" = "Adv", "Date" = "Date", - "FcstDate" = paste0("Hr", y, "FcstDate"), - "Lat" = paste0("Hr", y, "Lat"), - "Lon" = paste0("Hr", y, "Lon"), - "Wind" = paste0("Hr", y, "Wind"), - "Gust" = paste0("Hr", y, "Gust"))}) %>% + dplyr::rename( + "Key" = "Key", + "Adv" = "Adv", + "Date" = "Date", + "FcstDate" = paste0("Hr", y, "FcstDate"), + "Lat" = paste0("Hr", y, "Lat"), + "Lon" = paste0("Hr", y, "Lon"), + "Wind" = paste0("Hr", y, "Wind"), + "Gust" = paste0("Hr", y, "Gust") + ) + } + ) %>% dplyr::arrange(.data$Key, .data$Date, .data$Adv, .data$FcstDate) # Remove NA rows forecasts <- forecasts[stats::complete.cases( forecasts$FcstDate, forecasts$Lat, forecasts$Lon, forecasts$Wind, - forecasts$Gust),] + forecasts$Gust + ), ] + return(forecasts) } @@ -708,9 +750,9 @@ tidy_fcst <- function(df) { #' } #' @export tidy_fcst_wr <- function(df) { - - if (!is.data.frame(df)) + if (!is.data.frame(df)) { stop("Expecting a dataframe.") + } # Build wind radius dataframe for each forecast position (12:72 hours; 96 # and 120 hours are never forecasted). This dataframe will be similar to @@ -721,7 +763,7 @@ tidy_fcst_wr <- function(df) { # What forecast periods are in the current dataset? fcst_periods <- as.list(names(df)) %>% stringr::str_match(pattern = "Hr([:digit:]{2})FcstDate") %>% - .[,2] %>% + .[, 2] %>% .[!rlang::are_na(.)] %>% as.numeric() @@ -730,9 +772,10 @@ tidy_fcst_wr <- function(df) { .f = function(x) { if (x %in% c(12, 24, 36)) fcst_wind_radii <- c(34, 50, 64) if (x %in% c(48, 72)) fcst_wind_radii <- c(34, 50) - if (x %in% c(96, 120)) return(NULL) + if (x %in% c(96, 120)) { + return(NULL) + } y <- purrr::map_df(.x = fcst_wind_radii, .f = function(z) { - df %>% dplyr::select(c( "Key", "Adv", "Date", paste0("Hr", x, "FcstDate"), @@ -746,23 +789,27 @@ tidy_fcst_wr <- function(df) { "NE" = paste0("Hr", x, "NE", z), "SE" = paste0("Hr", x, "SE", z), "SW" = paste0("Hr", x, "SW", z), - "NW" = paste0("Hr", x, "NW", z)) %>% + "NW" = paste0("Hr", x, "NW", z) + ) %>% dplyr::mutate("WindField" = z) %>% dplyr::select(c( .data$Key:.data$FcstDate, "WindField", - .data$NE:.data$NW)) - }) + .data$NE:.data$NW + )) + }) + return(y) - }) + } + ) fcst_wr <- dplyr::arrange( fcst_wr, .data$Key, .data$Date, .data$Adv, .data$FcstDate, .data$WindField ) fcst_wr <- fcst_wr[stats::complete.cases( - fcst_wr$NE, fcst_wr$SE, fcst_wr$SW, fcst_wr$NW),] + fcst_wr$NE, fcst_wr$SE, fcst_wr$SW, fcst_wr$NW + ), ] return(fcst_wr) - } diff --git a/R/get_storm_data.R b/R/get_storm_data.R index 864ee38f..54e3f467 100644 --- a/R/get_storm_data.R +++ b/R/get_storm_data.R @@ -4,7 +4,6 @@ #' @param product specific product to parse #' @keywords internal extract_product_contents <- function(links, product) { - contents <- get_url_contents(links) # Some products may not exist within HTML but as strict text. @@ -13,7 +12,7 @@ extract_product_contents <- function(links, product) { contents <- links %>% - get_url_contents() %>% # Read in contents as html + get_url_contents() %>% # Read in contents as html # If text is not within html, then we simply need to return the text. # Otherwise, extract the node from within the HTML and return the text of # that node. @@ -31,7 +30,6 @@ extract_product_contents <- function(links, product) { }) purrr::invoke_map_df(product, .x = list(list(contents))) - } #' @title extract_storm_links @@ -39,9 +37,9 @@ extract_product_contents <- function(links, product) { #' @param links URLs to a storm's archive page #' @keywords internal extract_storm_links <- function(links) { - - if (!is.vector(links)) + if (!is.vector(links)) { stop("Links must be a character vector.", call. = FALSE) + } # Get links of text products from each `links` product_links <- @@ -49,12 +47,12 @@ extract_storm_links <- function(links) { get_url_contents() %>% purrr::imap(.f = xml2::read_html) %>% # Extract the html tables from each link to get the storm's text products - purrr::imap(.f = ~rvest::html_nodes(.x, xpath = "//td//a")) %>% + purrr::imap(.f = ~ rvest::html_nodes(.x, xpath = "//td//a")) %>% # Extract the text product URLs from `nodes` - purrr::imap(.f = ~rvest::html_attr(.x, name = "href")) %>% + purrr::imap(.f = ~ rvest::html_attr(.x, name = "href")) %>% purrr::flatten_chr() %>% # Ensure we're only capturing archive pages - stringr::str_match( "archive.+") %>% + stringr::str_match("archive.+") %>% .[stats::complete.cases(.)] # Extract years from `links` @@ -64,8 +62,10 @@ extract_storm_links <- function(links) { # other years, product_links are absolute. If product_links exist for 1998 # they must be modified. All product_links must then be prefixed with # NHC URL. - product_links[years == 1998] <- stringr::str_c("/archive/1998/", - product_links[years == 1998]) + product_links[years == 1998] <- stringr::str_c( + "/archive/1998/", + product_links[years == 1998] + ) product_links <- stringr::str_c(get_nhc_link(), product_links) } @@ -128,10 +128,11 @@ get_product <- function(links, product) { #' get_storm_data(products = c("discus", "public")) #' } #' @export -get_storm_data <- function(links, products = c("discus", "fstadv", "posest", - "public", "prblty", "update", - "wndprb")) { - +get_storm_data <- function(links, products = c( + "discus", "fstadv", "posest", + "public", "prblty", "update", + "wndprb" + )) { products <- match.arg(products, several.ok = TRUE) product_links <- extract_storm_links(links) @@ -144,6 +145,8 @@ get_storm_data <- function(links, products = c("discus", "fstadv", "posest", product_links <- rlang::set_names(product_links, nm = products) - purrr::map2(product_links, products, extract_product_contents) + # Filter out empty list elements + product_links <- Filter(length, product_links) + purrr::map2(product_links, names(product_links), extract_product_contents) } diff --git a/R/get_storm_list.R b/R/get_storm_list.R index a5c7ebaa..b6cb9d41 100644 --- a/R/get_storm_list.R +++ b/R/get_storm_list.R @@ -3,29 +3,17 @@ #' @export get_storm_list <- function() { - # 2018-12-29 - On Dec. 9, an update was made putting a newline at the - # beginning of the text file. This threw off the original code generating - # warnings. Instead of reading directly as CSV, read in as character, trim - # whitespace, then read CSV. - - # Read in file as string - txt <- readChar( - "ftp://ftp.nhc.noaa.gov/atcf/index/storm_list.txt", - nchars = 252928) - - # Remove any trailing white space - clean_txt <- stringr::str_trim(txt) - # Return dataframe - readr::read_csv( - file = clean_txt, - col_names = c( - "STORM_NAME", "RE", "X", "R2", "R3", "R4", "R5", "CY", "YYYY", "TY", - "I", "YYY1MMDDHH", "YYY2MMDDHH", "SIZE", "GENESIS_NUM", "PAR1", "PAR2", - "PRIORITY", "STORM_STATE", "WT_NUMBER", "STORMID" - ), - col_types = "ccccccciiccccciccicic" - ) %>% + storm_list <- + readr::read_csv( + file = "ftp://ftp.nhc.noaa.gov/atcf/index/storm_list.txt", + col_names = c( + "STORM_NAME", "RE", "X", "R2", "R3", "R4", "R5", "CY", "YYYY", "TY", + "I", "YYY1MMDDHH", "YYY2MMDDHH", "SIZE", "GENESIS_NUM", "PAR1", "PAR2", + "PRIORITY", "STORM_STATE", "WT_NUMBER", "STORMID" + ), + col_types = "ccccccciiccccciccicic" + ) %>% dplyr::mutate_at( .vars = c("YYY1MMDDHH", "YYY2MMDDHH"), .f = as.POSIXct, @@ -63,11 +51,12 @@ get_ftp_dirs <- function(x) { #' @export #' @seealso \code{\link{get_storm_data}} get_ftp_storm_data <- function(stormid, - products = c("discus", "fstadv", "posest", - "public", "prblty", "update", - "wndprb")) { - - if (!grepl("(AL|EP)\\d{6}", stormid)) + products = c( + "discus", "fstadv", "posest", + "public", "prblty", "update", + "wndprb" + )) { + if (!grepl("(AL|EP)\\d{6}", stormid)) { stop( stringr::str_c( "stormid should be an alphanumeric string with the basin abbreviation ", @@ -76,9 +65,10 @@ get_ftp_storm_data <- function(stormid, .call = FALSE ) ) + } # What year is the storm? - yyyy <- as.integer(stringr::str_match(stormid, "^.+(\\d{4})$")[,2]) + yyyy <- as.integer(stringr::str_match(stormid, "^.+(\\d{4})$")[, 2]) # List all directories in the ftp's archives archives <- get_ftp_dirs(x = "/atcf/archive/") @@ -145,7 +135,8 @@ get_ftp_storm_data <- function(stormid, dplyr::pull(.data$Name) pkg <- sprintf( - fmt = "ftp://ftp.nhc.noaa.gov/atcf/archive/%s/messages/%s", + fmt = "%satcf/archive/%s/messages/%s", + get_nhc_ftp_link(), yyyy, links ) @@ -192,18 +183,17 @@ get_ftp_storm_data <- function(stormid, files_length <- purrr::map(.x = files, .f = file.info) %>% purrr::map_dbl("size") res_txt <- purrr::map2_chr(.x = files, .y = files_length, readChar) - } else { links <- sprintf( - fmt = "ftp://ftp.nhc.noaa.gov/atcf/archive/%s/messages/%s", + fmt = "%satcf/archive/%s/messages/%s", + get_nhc_ftp_link(), yyyy, links ) res <- get_url_contents(links) - res_parsed <- purrr::map(res, ~xml2::read_html(.$content)) + res_parsed <- purrr::map(res, ~ xml2::read_html(.$content)) res_txt <- purrr::map_chr(res_parsed, rvest::html_text) - } } else { # If the `yyyy` value is not in the ftp archives, then it is in a product @@ -226,39 +216,53 @@ get_ftp_storm_data <- function(stormid, "wndprb" = "wndprb" ) + # Because some products may be requested that do not exist (i.e., update, + # posest, filter out, just in case) + products <- products[which(products %in% names(named_products))] ftp_subdir <- sprintf("atcf/%s/", named_products[products]) - ftp_contents <- get_ftp_dirs(ftp_subdir) + ftp_contents <- purrr::map(ftp_subdir, get_ftp_dirs) - links <- + ftp_content_links <- ftp_contents %>% - dplyr::filter( - grepl( - pattern = - sprintf( - fmt = "^%s\\.%s\\.\\d{3}$", - stringr::str_to_lower(stormid), - products - ), - x = .data$Name + purrr::map2(ftp_subdir, ~paste0(.y, .x$Name)) + + # Make sure we're only using the links for the requested storm; filter out + # all others. + filtered_links <- + purrr::map( + .x = seq_along(ftp_content_links), + .f = ~grep( + pattern = paste0(".+", stormid, ".+"), + x = ftp_content_links[[.x]], + ignore.case = TRUE, + value = TRUE ) - ) %>% - dplyr::pull(.data$Name) + ) - links <- sprintf( - fmt = "ftp://ftp.nhc.noaa.gov/atcf/%s/%s", - named_products[products], - links - ) + # Set names of list to products + names(filtered_links) <- products - res <- get_url_contents(links) - res_parsed <- purrr::map(res, ~xml2::read_html(.$content)) - res_txt <- purrr::map_chr(res_parsed, rvest::html_text) + # Make full links + full_links <- purrr::map( + .x = filtered_links, + .f = ~sprintf( + fmt = "%s%s", + get_nhc_ftp_link(), + .x + ) + ) + res_txt <- purrr::map(full_links, get_url_contents) } - df <- purrr::invoke_map_df( - .f = utils::getFromNamespace(x = products, ns = "rrricanes"), - .x = res_txt - ) + df <- + purrr::map( + .x = names(res_txt), + .f = ~rlang::exec( + .fn = utils::getFromNamespace(x = .x, ns = "rrricanes"), + contents = res_txt[[.x]] + ) + ) %>% + rlang::set_names(nm = names(res_txt)) } diff --git a/R/get_storms.R b/R/get_storms.R index 4e01842c..4088435f 100644 --- a/R/get_storms.R +++ b/R/get_storms.R @@ -5,7 +5,6 @@ #' @return 4xN Dataframe #' @keywords internal extract_storms <- function(basin, contents) { - xpaths <- list( "AL" = "//td[(((count(preceding-sibling::*) + 1) = 1) and parent::*)]//a", "EP" = "//td[(((count(preceding-sibling::*) + 1) = 2) and parent::*)]//a" @@ -28,7 +27,7 @@ extract_storms <- function(basin, contents) { links <- storms %>% purrr::map(rvest::html_attr, name = "href") %>% - purrr::map2(years, ~stringr::str_c(year_archives_link(.y), .x)) %>% + purrr::map2(years, ~ stringr::str_c(year_archives_link(.y), .x)) %>% purrr::flatten_chr() names <- @@ -92,16 +91,20 @@ extract_storms <- function(basin, contents) { #' @export get_storms <- function(years = format(Sys.Date(), "%Y"), basins = c("AL", "EP")) { - years <- as.integer(years) - if (!all(years %in% 1998:lubridate::year(Sys.Date()))) - stop(sprintf("Param `years` must be between 1998 and %s.", - lubridate::year(Sys.Date())), - call. = FALSE) + if (!all(years %in% 1998:lubridate::year(Sys.Date()))) { + stop(sprintf( + "Param `years` must be between 1998 and %s.", + lubridate::year(Sys.Date()) + ), + call. = FALSE + ) + } - if (!all(basins %in% c("AL", "EP"))) + if (!all(basins %in% c("AL", "EP"))) { stop("Basin must 'AL' and/or 'EP'.", call. = FALSE) + } links <- years %>% @@ -109,13 +112,14 @@ get_storms <- function(years = format(Sys.Date(), "%Y"), purrr::flatten_chr() # 1998 is only year with slightly different URL. Modify accordingly - links[grep("1998", links)] <- stringr::str_c(links[grep("1998", links)], - "1998archive.shtml") + links[grep("1998", links)] <- stringr::str_c( + links[grep("1998", links)], + "1998archive.shtml" + ) contents <- get_url_contents(links) purrr::map_df(basins, extract_storms, contents) - } #' @title year_archives_link @@ -124,5 +128,5 @@ get_storms <- function(years = format(Sys.Date(), "%Y"), #' @keywords internal year_archives_link <- function(year) { nhc_link <- get_nhc_link() - sprintf(stringr::str_c(nhc_link, 'archive/%i/'), year) + sprintf(stringr::str_c(nhc_link, "archive/%i/"), year) } diff --git a/R/gis.R b/R/gis.R index c8aa4229..ae1cc38c 100644 --- a/R/gis.R +++ b/R/gis.R @@ -7,46 +7,61 @@ #' @seealso \code{\link{gis_download}} #' @export gis_advisory <- function(key, advisory = as.character()) { - - if (is.null(key)) + if (is.null(key)) { stop("Please provide a `key`.", call. = FALSE) + } key <- stringr::str_to_lower(key) - if (!grepl("^[[:lower:]]{2}[[:digit:]]{6}$", key)) + if (!grepl("^[[:lower:]]{2}[[:digit:]]{6}$", key)) { stop("`key` should be a 8-character alphanumeric string.", call. = FALSE) + } - key <- stringr::str_match(key, - pattern = stringr::str_c("([:lower:]{2})([:digit:]{2})", - "([:digit:]{4})")) + key <- stringr::str_match( + key, + pattern = stringr::str_c( + "([:lower:]{2})([:digit:]{2})", + "([:digit:]{4})" + ) + ) # Get list of GIS forecast zips for storm and download - url <- sprintf("%sgis/archive_forecast_results.php?id=%s%s&year=%s", - get_nhc_link(), - key[,2], # Basin - key[,3], # Storm number - key[,4]) # Year + url <- sprintf( + "%sgis/archive_forecast_results.php?id=%s%s&year=%s", + get_nhc_link(), + key[, 2], # Basin + key[, 3], # Storm number + key[, 4] + ) # Year contents <- readr::read_lines(url) # Match zip files. If advisory is empty then need to pull all zip files for # the storm. Otherwise, pull only selected advisory. if (purrr::is_empty(advisory)) { - ptn <- sprintf(".+(forecast/archive/%s.*?\\.zip).+", - stringr::str_to_lower(key[,1])) + ptn <- sprintf( + ".+(forecast/archive/%s.*?\\.zip).+", + stringr::str_to_lower(key[, 1]) + ) } else { advisory <- stringr::str_match(advisory, "([:digit:]{1,3})([:alpha:]*)") names(advisory) <- c("original", "advisory", "int_adv") - ptn <- sprintf(".+(forecast/archive/%s.*?%s%s\\.zip).+", - stringr::str_to_lower(key[,1]), - stringr::str_pad(string = advisory[["advisory"]], - width = 3, side = "left", pad = "0"), - advisory[["int_adv"]]) + ptn <- sprintf( + ".+(forecast/archive/%s.*?%s%s\\.zip).+", + stringr::str_to_lower(key[, 1]), + stringr::str_pad( + string = advisory[["advisory"]], + width = 3, side = "left", pad = "0" + ), + advisory[["int_adv"]] + ) } - matches <- stringr::str_match(contents, pattern = ptn)[,2] + matches <- stringr::str_match(contents, pattern = ptn)[, 2] matches <- matches[stats::complete.cases(matches)] - if (purrr::is_empty(matches)) return(NULL) + if (purrr::is_empty(matches)) { + return(NULL) + } # Append website domain to links stringr::str_c(get_nhc_link(), "gis/", matches) @@ -71,7 +86,6 @@ gis_advisory <- function(key, advisory = as.character()) { #' unofficial and sites not on the list can be selected if conditions warrant. #' @export gis_breakpoints <- function() { - breakpoint_file <- stringr::str_c(get_nhc_link, "gis/") %>% xml2::read_html() %>% @@ -84,39 +98,23 @@ gis_breakpoints <- function() { .[stats::complete.cases(.)] stringr::str_c(get_nhc_link(withTrailingSlash = FALSE), breakpoint_file) - } #' @title gis_download #' @description Get GIS data for storm. #' @param url link to GIS dataset to download. -#' @param ... additional parameters for rgdal::readOGR +#' @param destdir The destination directory to download and extract the zip file +#' @param ... additional parameters for file.path #' @export -gis_download <- function(url, ...) { - - destdir <- tempdir() +gis_download <- function(url, destdir = tempdir(), ...) { - utils::download.file(file.path(url), zip_file <- tempfile()) + utils::download.file(file.path(url), zip_file <- tempfile(), ...) zip_contents <- utils::unzip(zip_file, list = TRUE)$Name utils::unzip(zip_file, exdir = destdir) - shp_files <- stringr::str_match(zip_contents, pattern = ".+shp$") - shp_files <- shp_files[stats::complete.cases(shp_files)] - - ds <- - purrr::map2( - .x = destdir, - .y = stringr::str_replace(shp_files, "\\.shp", ""), - .f = rgdal::readOGR, - encoding = "UTF-8", - stringsAsFactors = FALSE, - use_iconv = TRUE, - ... - ) - - rlang::set_names(ds, nm = stringr::str_replace(shp_files, "\\.shp", "")) + return(zip_contents) } @@ -126,23 +124,27 @@ gis_download <- function(url, ...) { #' @param ... additional parameters for rgdal::readOGR #' @export gis_latest <- function(basins = c("AL", "EP"), ...) { - - if (!(all(basins %in% c("AL", "EP")))) + if (!(all(basins %in% c("AL", "EP")))) { stop("Basin must be one or both of AL or EP.", call. = FALSE) + } - urls <- list("AL" = stringr::str_c(get_nhc_link(), "gis-at.xml"), - "EP" = stringr::str_c(get_nhc_link(), "gis-ep.xml")) + urls <- list( + "AL" = stringr::str_c(get_nhc_link(), "gis-at.xml"), + "EP" = stringr::str_c(get_nhc_link(), "gis-ep.xml") + ) gis_zips <- basins %>% - purrr::map(~xml2::read_xml(urls[[.x]])) %>% + purrr::map(~ xml2::read_xml(urls[[.x]])) %>% purrr::map(~ xml2::xml_find_all(.x, xpath = ".//link") %>% - xml2::xml_text()) %>% + xml2::xml_text()) %>% purrr::map(stringr::str_match, ".+\\.zip$") %>% purrr::flatten_chr() %>% .[!is.na(.)] - if (purrr::is_empty(gis_zips)) return(NULL) + if (purrr::is_empty(gis_zips)) { + return(NULL) + } purrr::map(gis_zips, gis_download, ...) } @@ -193,50 +195,65 @@ gis_outlook <- function() { #' gis_prob_storm_surge("AL092016", products = list("psurge" = 0, "esurge" = 10)) #' #' # Return all psurge0 products for Sep 2, 2016, storm AL092016 -#' gis_prob_storm_surge("AL092016", products = list("psurge" = 0), -#' datetime = "20160902") +#' gis_prob_storm_surge("AL092016", +#' products = list("psurge" = 0), +#' datetime = "20160902" +#' ) #' } #' @export gis_prob_storm_surge <- function(key, products, datetime = NULL) { - - if (is.null(key)) + if (is.null(key)) { stop("Please provide a storm `key`.", call. = FALSE) + } # Validate products - if (!(all(names(products) %in% c("psurge", "esurge")))) + if (!(all(names(products) %in% c("psurge", "esurge")))) { stop("`products` must be 'psurge' and/or 'esurge'.", call. = FALSE) + } - if (!is.null(products[["psurge"]])) - if (!(all(dplyr::between(products[["psurge"]], 0, 20)))) + if (!is.null(products[["psurge"]])) { + if (!(all(dplyr::between(products[["psurge"]], 0, 20)))) { stop("'psurge' values must be between 0 and 20.", call. = FALSE) + } + } - if (!is.null(products[["esurge"]])) - if (!(all(products[["esurge"]] %in% seq(10, 50, by = 10)))) + if (!is.null(products[["esurge"]])) { + if (!(all(products[["esurge"]] %in% seq(10, 50, by = 10)))) { stop("'esurge' values must be 10, 20, 30, 40 or 50.", call. = FALSE) + } + } key <- stringr::str_to_lower(key) - if (!grepl("^[[:lower:]]{2}[[:digit:]]{6}$", key)) + if (!grepl("^[[:lower:]]{2}[[:digit:]]{6}$", key)) { stop("`key` should be a 8-character alphanumeric string.", call. = FALSE) + } key <- stringr::str_match(key, - pattern = stringr::str_c("([:lower:]{2})([:digit:]", - "{2})([:digit:]{4})")) + pattern = stringr::str_c( + "([:lower:]{2})([:digit:]", + "{2})([:digit:]{4})" + ) + ) # Get list of GIS forecast zips for storm and download - url <- sprintf("%sgis/archive_psurge_results.php?id=%s%s&year=%s", - get_nhc_link(), - key[,2], # Basin - key[,3], # Storm number - key[,4]) # Year + url <- sprintf( + "%sgis/archive_psurge_results.php?id=%s%s&year=%s", + get_nhc_link(), + key[, 2], # Basin + key[, 3], # Storm number + key[, 4] + ) # Year contents <- readr::read_lines(url) # Build product pattern ptn_product <- - purrr::map2(.x = names(products), - .y = products, - .f = stringr::str_c) %>% + purrr::map2( + .x = names(products), + .y = products, + .f = stringr::str_c + ) %>% purrr::flatten_chr() # Build datetime pattern @@ -254,15 +271,19 @@ gis_prob_storm_surge <- function(key, products, datetime = NULL) { } # Match zip files. - ptn <- sprintf(".+(storm_surge/%s_(%s)_(%s)\\.zip).+", - stringr::str_to_lower(key[,1]), - stringr::str_c(ptn_product, collapse = "|"), - ptn_datetime) - - matches <- stringr::str_match(contents, pattern = ptn)[,2] + ptn <- sprintf( + ".+(storm_surge/%s_(%s)_(%s)\\.zip).+", + stringr::str_to_lower(key[, 1]), + stringr::str_c(ptn_product, collapse = "|"), + ptn_datetime + ) + + matches <- stringr::str_match(contents, pattern = ptn)[, 2] matches <- matches[stats::complete.cases(matches)] - if (purrr::is_empty(matches)) return(NULL) + if (purrr::is_empty(matches)) { + return(NULL) + } stringr::str_c(get_nhc_link(), "gis/", matches) } @@ -277,54 +298,67 @@ gis_prob_storm_surge <- function(key, products, datetime = NULL) { gis_storm_surge_flood <- function(key, advisory = as.numeric(), products = c("inundation", "tidalmask")) { - if (is.null(key)) stop("Please provide a storm `key`.", call. = FALSE) key <- stringr::str_to_upper(key) - if (!grepl("^[[:alpha:]]{2}[[:digit:]]{6}$", key)) + if (!grepl("^[[:alpha:]]{2}[[:digit:]]{6}$", key)) { stop("`key` should be a 8-character alphanumeric string.", call. = FALSE) + } - if (!(any(products %in% c("inundation", "tidalmask")))) + if (!(any(products %in% c("inundation", "tidalmask")))) { stop("`products` must be 'inundation' or 'tidalmask'.", call. = FALSE) + } key <- stringr::str_match(key, - pattern = stringr::str_c("([:alpha:]{2})([:digit:]", - "{2})([:digit:]{4})")) + pattern = stringr::str_c( + "([:alpha:]{2})([:digit:]", + "{2})([:digit:]{4})" + ) + ) # Get list of GIS zips for storm and download - url <- sprintf("%sgis/archive_inundation_results.php?id=%s%s&year=%s", - get_nhc_link(), - key[,2], # Basin - key[,3], # Storm number - key[,4]) # Year + url <- sprintf( + "%sgis/archive_inundation_results.php?id=%s%s&year=%s", + get_nhc_link(), + key[, 2], # Basin + key[, 3], # Storm number + key[, 4] + ) # Year contents <- readr::read_lines(url) if (purrr::is_empty(advisory)) { - ptn <- sprintf(".+(%s/%s%s%s_[:digit:]{1,2}_(%s)\\.zip).+", - "inundation/forecasts", - key[,2], - key[,3], - stringr::str_sub(key[,4], start = 3L, end = 4L), - stringr::str_c(products, collapse = "|")) + ptn <- sprintf( + ".+(%s/%s%s%s_[:digit:]{1,2}_(%s)\\.zip).+", + "inundation/forecasts", + key[, 2], + key[, 3], + stringr::str_sub(key[, 4], start = 3L, end = 4L), + stringr::str_c(products, collapse = "|") + ) } else { - ptn <- sprintf(".+(inundation/forecasts/%s%s%s_%s_(%s)\\.zip).+", - key[,2], - key[,3], - stringr::str_sub(key[,4], start = 3L, end = 4L), - stringr::str_pad(advisory, width = 2, side = "left", - pad = "0"), - stringr::str_c(products, collapse = "|")) + ptn <- sprintf( + ".+(inundation/forecasts/%s%s%s_%s_(%s)\\.zip).+", + key[, 2], + key[, 3], + stringr::str_sub(key[, 4], start = 3L, end = 4L), + stringr::str_pad(advisory, + width = 2, side = "left", + pad = "0" + ), + stringr::str_c(products, collapse = "|") + ) } - matches <- stringr::str_match(contents, pattern = ptn)[,2] + matches <- stringr::str_match(contents, pattern = ptn)[, 2] matches <- matches[stats::complete.cases(matches)] - if (purrr::is_empty(matches)) return(NULL) + if (purrr::is_empty(matches)) { + return(NULL) + } stringr::str_c(get_nhc_link(), "gis/", matches) - } #' @title gis_windfield @@ -345,47 +379,61 @@ gis_storm_surge_flood <- function(key, #' @seealso \code{\link{gis_download}} #' @export gis_windfield <- function(key, advisory = as.character()) { - - if (is.null(key)) + if (is.null(key)) { stop("Please provide a storm `key`.", call. = FALSE) + } key <- stringr::str_to_lower(key) - if (!grepl("^[[:lower:]]{2}[[:digit:]]{6}$", key)) + if (!grepl("^[[:lower:]]{2}[[:digit:]]{6}$", key)) { stop("`key` should be a 8-character alphanumeric string.", call. = FALSE) + } key <- stringr::str_match(key, - pattern = stringr::str_c("([:lower:]{2})([:digit:]", - "{2})([:digit:]{4})")) + pattern = stringr::str_c( + "([:lower:]{2})([:digit:]", + "{2})([:digit:]{4})" + ) + ) # Get list of GIS forecast zips for storm and download - url <- sprintf("%sgis/archive_forecast_info_results.php?id=%s%s&year=%s", - get_nhc_link(), - key[,2], # Basin - key[,3], # Storm number - key[,4]) # Year + url <- sprintf( + "%sgis/archive_forecast_info_results.php?id=%s%s&year=%s", + get_nhc_link(), + key[, 2], # Basin + key[, 3], # Storm number + key[, 4] + ) # Year contents <- readr::read_lines(url) # Match zip files. If advisory is empty then need to pull all zip files for # the storm. Otherwise, pull only selected advisory. if (purrr::is_empty(advisory)) { - ptn <- sprintf(".+(forecast/archive/%s.*?\\.zip).+", - stringr::str_to_lower(key[,1])) + ptn <- sprintf( + ".+(forecast/archive/%s.*?\\.zip).+", + stringr::str_to_lower(key[, 1]) + ) } else { advisory <- stringr::str_match(advisory, "([:digit:]{1,3})([:alpha:]*)") names(advisory) <- c("original", "advisory", "int_adv") - ptn <- sprintf(".+(forecast/archive/%s.*?%s%s\\.zip).+", - stringr::str_to_lower(key[,1]), - stringr::str_pad(string = advisory[["advisory"]], - width = 3, side = "left", pad = "0"), - advisory[["int_adv"]]) + ptn <- sprintf( + ".+(forecast/archive/%s.*?%s%s\\.zip).+", + stringr::str_to_lower(key[, 1]), + stringr::str_pad( + string = advisory[["advisory"]], + width = 3, side = "left", pad = "0" + ), + advisory[["int_adv"]] + ) } - matches <- stringr::str_match(contents, pattern = ptn)[,2] + matches <- stringr::str_match(contents, pattern = ptn)[, 2] matches <- matches[stats::complete.cases(matches)] - if (purrr::is_empty(matches)) return(NULL) + if (purrr::is_empty(matches)) { + return(NULL) + } stringr::str_c(get_nhc_link(), "gis/", matches) } @@ -410,12 +458,13 @@ gis_windfield <- function(key, advisory = as.character()) { #' } #' @export gis_wsp <- function(datetime, res = c(5, 0.5, 0.1)) { - - if (!grepl("[[:digit:]]{4,10}", datetime)) + if (!grepl("[[:digit:]]{4,10}", datetime)) { stop("`datetime` should be between 4 and 10 digits.", call. = FALSE) + } - if (!(all(res %in% c(5.0, 0.5, 0.1)))) + if (!(all(res %in% c(5.0, 0.5, 0.1)))) { stop("`res` should be one or more of 5.0, 0.5, or 0.1.", call. = FALSE) + } res <- as.character(res) res <- stringr::str_replace(res, "^5$", "5km") @@ -449,22 +498,3 @@ gis_wsp <- function(datetime, res = c(5, 0.5, 0.1)) { stringr::str_c(get_nhc_link(), "gis/", links) } - -#' @title shp_to_df -#' @description Convert shapefile object to dataframe -#' @param obj Spatial object to convert. See details. -#' @details Takes a SpatialLinesDataFrame object or SpatialPolygonsDataFrame -#' object and converts into a dataframe that can be plotted in ggplot2. -#' @export -shp_to_df <- function(obj) { - - if (class(obj) %in% c("SpatialLinesDataFrame", "SpatialPolygonsDataFrame")) { - obj@data$id <- rownames(obj@data) - obj <- dplyr::left_join(broom::tidy(obj, region = "id"), - obj@data, by = "id") %>% - tibble::as_tibble() - } - - obj - -} diff --git a/R/posest.R b/R/posest.R index abd7ec7d..e4999081 100644 --- a/R/posest.R +++ b/R/posest.R @@ -25,7 +25,6 @@ get_posest <- function(links) { #' @seealso \code{\link{get_posest}} #' @keywords internal posest <- function(contents) { - status <- scrape_header( contents = contents, ptn_product_title = "(?:POSITION ESTIMATE)?", @@ -37,10 +36,9 @@ posest <- function(contents) { key <- scrape_key(contents) tibble::tibble( - Status = status[,1], - Name = status[,2], + Status = status[, 1], + Name = status[, 2], Date = issue_date, Contents = contents ) - } diff --git a/R/prblty.R b/R/prblty.R index 0c397618..7c17e564 100644 --- a/R/prblty.R +++ b/R/prblty.R @@ -29,7 +29,6 @@ get_prblty <- function(links) { #' @seealso \code{\link{get_prblty}} #' @keywords internal prblty <- function(contents) { - status <- scrape_header( contents = contents, # The "SPECIAL" pattern has to be left here; moving it under @@ -42,30 +41,33 @@ prblty <- function(contents) { # 15.0N 43.4W 43 1 X X 44 16.8N 48.2W X 4 16 2 22 # 15.8N 45.9W 1 26 1 X 28 - ptn <- stringr::str_c("(?<=[:blank:]{3}|\n)", - "([[:alpha:][:digit:][:punct:][:blank:]]{17})", # Location - "[:blank:]+", # Delimiter - "([:digit:]{1,2}|X)", # A - "[:blank:]+", # Delimiter - "([:digit:]{1,2}|X)", # B - "[:blank:]+", # Delimiter - "([:digit:]{1,2}|X)", # C - "[:blank:]+", # Delimiter - "([:digit:]{1,2}|X)", # D - "[:blank:]+", # Delimiter - "([:digit:]{1,2}|X)") # E + ptn <- stringr::str_c( + "(?<=[:blank:]{3}|\n)", + "([[:alpha:][:digit:][:punct:][:blank:]]{17})", # Location + "[:blank:]+", # Delimiter + "([:digit:]{1,2}|X)", # A + "[:blank:]+", # Delimiter + "([:digit:]{1,2}|X)", # B + "[:blank:]+", # Delimiter + "([:digit:]{1,2}|X)", # C + "[:blank:]+", # Delimiter + "([:digit:]{1,2}|X)", # D + "[:blank:]+", # Delimiter + "([:digit:]{1,2}|X)" + ) # E prblty <- contents %>% stringr::str_match_all(ptn) %>% purrr::map(tibble::as_tibble) %>% purrr::map( - rlang::set_names, nm = c("X1", "Location", "A", "B", "C", "D", "E") + rlang::set_names, + nm = c("X1", "Location", "A", "B", "C", "D", "E") ) %>% - purrr::map2(status[,1], ~tibble::add_column(.x, Status = .y, .before = 1)) %>% - purrr::map2(status[,2], ~tibble::add_column(.x, Name = .y, .after = 1)) %>% - purrr::map2(status[,3], ~tibble::add_column(.x, Adv = .y, .after = 2)) %>% - purrr::map2(issue_date, ~tibble::add_column(.x, Date = .y, .after = 3)) %>% + purrr::map2(status[, 1], ~ tibble::add_column(.x, Status = .y, .before = 1)) %>% + purrr::map2(status[, 2], ~ tibble::add_column(.x, Name = .y, .after = 1)) %>% + purrr::map2(status[, 3], ~ tibble::add_column(.x, Adv = .y, .after = 2)) %>% + purrr::map2(issue_date, ~ tibble::add_column(.x, Date = .y, .after = 3)) %>% purrr::map_df(tibble::as_tibble) %>% dplyr::select(-c("X1")) %>% # Trim whitespace @@ -86,5 +88,4 @@ prblty <- function(contents) { .vars = c(6:10), .funs = "as.numeric" ) - } diff --git a/R/public.R b/R/public.R index b72beb60..e6c6ab66 100644 --- a/R/public.R +++ b/R/public.R @@ -25,7 +25,6 @@ get_public <- function(links) { #' @seealso \code{\link{get_public}} #' @keywords internal public <- function(contents) { - status <- scrape_header( contents = contents, # The "SPECIAL" pattern has to be left here; moving it under @@ -38,12 +37,11 @@ public <- function(contents) { key <- scrape_key(contents) tibble::tibble( - Status = status[,1], - Name = status[,2], - Adv = status[,3], + Status = status[, 1], + Name = status[, 2], + Adv = status[, 3], Date = issue_date, Key = key, Contents = contents ) - } diff --git a/R/scrapers.R b/R/scrapers.R index 7f3aa6db..4f0693de 100644 --- a/R/scrapers.R +++ b/R/scrapers.R @@ -4,9 +4,7 @@ #' @seealso \code{\link{scrape_header}} #' @keywords internal scrape_date <- function(header) { - maketime <- function(h, m, p) { - h <- as.numeric(h) m <- as.numeric(m) @@ -22,7 +20,6 @@ scrape_date <- function(header) { m <- stringr::str_pad(m, 2, side = "left", pad = "0") stringr::str_c(h, m, sep = ":") - } # The time value in the headers can vary depending on the product. In @@ -44,76 +41,97 @@ scrape_date <- function(header) { any( stringr::str_count( header, - pattern = stringr::str_c("\nNOON [:upper:]{3} [:upper:]{3} ", - "[:upper:]{3} [:digit:]{2} ", - "[:digit:]{4}\n")))) - + pattern = stringr::str_c( + "\nNOON [:upper:]{3} [:upper:]{3} ", + "[:upper:]{3} [:digit:]{2} ", + "[:digit:]{4}\n" + ) + ) + )) { header <- stringr::str_replace( header, - pattern = stringr::str_c("\n(NOON)", - "( [:upper:]{3}", - " [:upper:]{3} ", - "[:upper:]{3} ", - "[:digit:]{2} ", - "[:digit:]{4})\n"), - "\n12 PM\\2\n") + pattern = stringr::str_c( + "\n(NOON)", + "( [:upper:]{3}", + " [:upper:]{3} ", + "[:upper:]{3} ", + "[:digit:]{2} ", + "[:digit:]{4})\n" + ), + "\n12 PM\\2\n" + ) + } # Same thing for "MIDNIGHT" if ( any( stringr::str_count( header, - pattern = stringr::str_c("\nMIDNIGHT", - " [:upper:]{3} [:upper:]{3} ", - "[:upper:]{3} [:digit:]{2} ", - "[:digit:]{4}\n")))) - + pattern = stringr::str_c( + "\nMIDNIGHT", + " [:upper:]{3} [:upper:]{3} ", + "[:upper:]{3} [:digit:]{2} ", + "[:digit:]{4}\n" + ) + ) + )) { header <- stringr::str_replace( header, - pattern = stringr::str_c("\n(MIDNIGHT)( ", - "[:upper:]{3}", - " [:upper:]{3} ", - "[:upper:]{3} ", - "[:digit:]{2} ", - "[:digit:]{4})\n"), - "\n12 AM\\2\n") + pattern = stringr::str_c( + "\n(MIDNIGHT)( ", + "[:upper:]{3}", + " [:upper:]{3} ", + "[:upper:]{3} ", + "[:digit:]{2} ", + "[:digit:]{4})\n" + ), + "\n12 AM\\2\n" + ) + } # And yes there is actually an entry of 12 NOON; see AL132002 public adv 49A if ( any( stringr::str_count( header, - pattern = stringr::str_c("\n12 NOON", - " [:upper:]{3} [:upper:]{3} ", - "[:upper:]{3} [:digit:]{2} ", - "[:digit:]{4}\n")))) - + pattern = stringr::str_c( + "\n12 NOON", + " [:upper:]{3} [:upper:]{3} ", + "[:upper:]{3} [:digit:]{2} ", + "[:digit:]{4}\n" + ) + ) + )) { header <- stringr::str_replace( header, - pattern = stringr::str_c("\n(12 NOON)( ", - "[:upper:]{3}", - " [:upper:]{3} ", - "[:upper:]{3} ", - "[:digit:]{2} ", - "[:digit:]{4})\n"), - "\n12 PM\\2\n") + pattern = stringr::str_c( + "\n(12 NOON)( ", + "[:upper:]{3}", + " [:upper:]{3} ", + "[:upper:]{3} ", + "[:digit:]{2} ", + "[:digit:]{4})\n" + ), + "\n12 PM\\2\n" + ) + } ptn <- stringr::str_c( "(?<=(?:\n|\r))", - "([:digit:]{1,2})", # Hour + "([:digit:]{1,2})", # Hour "(?<=[:digit:]{1})([:digit:]{2})?", # Minute - "(?:Z)?", # For forecast; Z is (UTC) + "(?:Z)?", # For forecast; Z is (UTC) "[:blank:]", "(?:AM|PM)?[:blank:]?", - "([:alpha:]{3})*?", # Time zone, optional + "([:alpha:]{3})*?", # Time zone, optional "[:blank:]?", - "(?:[:alpha:]{3})", # Day of week, no capture + "(?:[:alpha:]{3})", # Day of week, no capture "[:blank:]", - "([:alpha:]{3})", # Month, abbreviated uppercase + "([:alpha:]{3})", # Month, abbreviated uppercase "[:blank:]", - "([:digit:]{1,2})", # Date + "([:digit:]{1,2})", # Date "[:blank:]", - "([:digit:]{4})", # Year + "([:digit:]{4})", # Year "[[:blank:]\n\r]*" ) @@ -123,23 +141,27 @@ scrape_date <- function(header) { period <- stringr::str_match(datetime.extracted, "[:blank:](AM|PM)[:blank:]") # Convert time values to 24-hour format, UTC - t <- maketime(datetime.extracted[,2], # Hour - datetime.extracted[,3], # Minute - period[,2]) + t <- maketime( + datetime.extracted[, 2], # Hour + datetime.extracted[, 3], # Minute + period[, 2] + ) # Format date - d <- as.Date(stringr::str_c(datetime.extracted[,5], # Month, abbreviated - datetime.extracted[,6], # Date, w/wo leading 0 - datetime.extracted[,7], # Year, four-digit format - sep = "-"), - format = "%b-%d-%Y") + d <- as.Date(stringr::str_c(datetime.extracted[, 5], # Month, abbreviated + datetime.extracted[, 6], # Date, w/wo leading 0 + datetime.extracted[, 7], # Year, four-digit format + sep = "-" + ), + format = "%b-%d-%Y" + ) # If time zone is NA, make UTC. Is NA because in forecast products time is # immeidately followed by Z which is not captured. Z is military code for # Zulu time which is equivalent of Z. # That should be the reason... - tz <- datetime.extracted[,4] + tz <- datetime.extracted[, 4] if (any(is.na(tz))) { i <- which(is.na(tz)) tz[i] <- "UTC" @@ -179,7 +201,6 @@ scrape_date <- function(header) { # Now convert to UTC lubridate::with_tz(dt, tzone = "UTC") - } #' @title scrape_header @@ -208,19 +229,20 @@ scrape_header <- function(contents, ptn_product_title, # Pattern for storm names ptn_names <- stringr::str_c("([\\w-]*?)") - ptn_adv = "NUMBER\\s+(\\d{1,3}\\w?)" + ptn_adv <- "NUMBER\\s+(\\d{1,3}\\w?)" # Combine patterns ptn <- stringr::str_c( - ptn_status, ptn_names, ptn_product_title, sep = "\\s" + ptn_status, ptn_names, ptn_product_title, + sep = "\\s" ) if (advisory_number) { - ptn <- stringr::str_c(ptn, ptn_adv, sep = "\\s") - matches <- stringr::str_match(header, ptn)[,2:4] + ptn <- stringr::str_c(ptn, ptn_adv, sep = "\\s") + matches <- stringr::str_match(header, ptn)[, 2:4] } else { - matches <- stringr::str_match(header, ptn)[,2:3] - status <- apply(stringr::str_match(header, ptn)[,2:3], 2, stringr::str_to_title) + matches <- stringr::str_match(header, ptn)[, 2:3] + status <- apply(stringr::str_match(header, ptn)[, 2:3], 2, stringr::str_to_title) } # String-to-title Status and Name @@ -230,11 +252,10 @@ scrape_header <- function(contents, ptn_product_title, matches[1:2] <- stringr::str_to_title(matches[1:2]) } else { # Working with a matrix - matches[,c(1:2)] <- apply(matches[,c(1:2)], 2, stringr::str_to_title) + matches[, c(1:2)] <- apply(matches[, c(1:2)], 2, stringr::str_to_title) } return(matches) - } #' @title scrape_key @@ -255,9 +276,7 @@ scrape_key <- function(header) { "([:alnum:]{6,8})" ) - ptn <- stringr::str_c(ptn, collapse = '') - - stringr::str_match(header, ptn)[,2] + ptn <- stringr::str_c(ptn, collapse = "") + stringr::str_match(header, ptn)[, 2] } - diff --git a/R/tracking_chart.R b/R/tracking_chart.R deleted file mode 100644 index 5a620052..00000000 --- a/R/tracking_chart.R +++ /dev/null @@ -1,137 +0,0 @@ -#' @title al_tracking_chart -#' @description Build tracking chart centered on Atlantic Basin. -#' @param ... Additional parameters for \link{tracking_chart} and ggplot2 -#' @seealso \code{\link{tracking_chart}} -#' @return ggplot2 object centered on Atlantic basin. -#' @examples -#' \dontrun{ -#' # Build map with white land areas, thin black borders -#' al_tracking_chart(color = "black", size = 0.1, fill = "white") -#' -#' # 50nm resolution, no states -#' al_tracking_chart(res = 50, states = FALSE, color = "black", size = 0.1, -#' fill = "white") -#' -#' # 50nm resolution, coastlines only -#' al_tracking_chart(countries = FALSE, res = 50, color = "black", size = 0.1, -#' fill = "white") -#' -#' # Adding and modifying with ggplot functions -#' al_tracking_chart(color = "black", size = 0.1, fill = "white") + -#' ggplot2::labs(x = "Lon", y = "Lat", -#' title = "Base Atlantic Tracking Chart") -#' } -#' @export -al_tracking_chart <- function(...) { - p <- tracking_chart(...) - p + ggplot2::coord_equal(xlim = c(-100, 0), ylim = c(0, 60)) -} - -#' @title ep_tracking_chart -#' @description Build tracking chart centered on northeast Pacific Basin. -#' @param ... Additional parameters for ggplot2 -#' @seealso \code{\link{tracking_chart}} -#' @return ggplot2 object centered on northeast Pacific basin. -#' @examples -#' \dontrun{ -#' # Build map with white land areas, thin black borders -#' ep_tracking_chart(color = "black", size = 0.1, fill = "white") -#' -#' # 50nm resolution, no states -#' ep_tracking_chart(res = 50, states = FALSE, color = "black", size = 0.1, -#' fill = "white") -#' -#' # 50nm resolution, coastlines only -#' ep_tracking_chart(countries = FALSE, res = 50, color = "black", size = 0.1, -#' fill = "white") -#' -#' # Adding and modifying with ggplot functions -#' ep_tracking_chart(color = "black", size = 0.1, fill = "white") + -#' ggplot2::labs(x = "Lon", y = "Lat", -#' title = "Base East Pacific Tracking Chart") -#' } -#' @export -ep_tracking_chart <- function(...) { - p <- tracking_chart(...) - p + ggplot2::coord_equal(xlim = c(-140, -80), ylim = c(0, 35)) -} - -#' @title tracking_chart -#' @description Build base tracking chart using ggplot -#' @param countries Show country borders. Default TRUE. -#' @param states Show state boundaries. Default TRUE. Ignored if `countries` is -#' FALSE. -#' @param res Resolution of charts; 110 (1:110m), 50 (1:50m), 10 (1:10m). -#' Default is low. The higher the resolution, the longer the plot takes to -#' appear. -#' @param ... Additional ggplot2::aes parameters -#' @return Returns ggplot2 object that can be printed directly or have new -#' layers added. -#' @seealso \code{\link[ggplot2]{aes}} -#' @examples -#' \dontrun{ -#' # Build map with white land areas, thin black borders -#' tracking_chart(color = "black", size = 0.1, fill = "white") -#' -#' # 50nm resolution, no states -#' tracking_chart(res = 50, states = FALSE, color = "black", size = 0.1, -#' fill = "white") -#' -#' # 50nm resolution, coastlines only -#' tracking_chart(countries = FALSE, res = 50, color = "black", size = 0.1, -#' fill = "white") -#' -#' # Adding and modifying with ggplot functions -#' tracking_chart(color = "black", size = 0.1, fill = "white") + -#' ggplot2::labs(x = "Lon", y = "Lat", title = "Base Tracking Chart") -#' } -#' @export -tracking_chart <- function(countries = TRUE, states = TRUE, res = 110, ...) { - - # Convert to numeric just in case - res <- as.integer(res) - - # Validate res - if (!(res %in% c(110, 50, 10))) - stop("Chart resolution must be 110, 50, 10") - - pkg <- "rnaturalearth" - if (res %in% c(110, 50)) { - pkg <- stringr::str_c(pkg, "data") - } else { - pkg <- stringr::str_c(pkg, "hires") - } - - # A base map can be drawn off either coastlines data or countries data. If - # countries is FALSE, return coastlines data. Otherwise, build countries w/ - # states if states is TRUE. - if (!countries) { - dataset <- stringr::str_c("coastline", res) - base_map_data <- getExportedValue(ns = pkg, name = dataset) - } else { - dataset <- stringr::str_c("countries", res) - base_map_data <- getExportedValue(ns = pkg, name = dataset) - if (states) { - if (res >= 50) { - dataset <- stringr::str_c("states", 50) - state_map_data <- getExportedValue(ns = pkg, name = dataset) - } else { - dataset <- stringr::str_c("states", res) - state_map_data <- getExportedValue(ns = pkg, name = dataset) - } - } - } - - p <- ggplot2::ggplot() + - ggplot2::geom_polygon(data = base_map_data, - ggplot2::aes(long, lat, group = group), ...) + - ggplot2::coord_equal() - - if (exists("state_map_data")) - p <- p + - ggplot2::geom_polygon(data = state_map_data, - ggplot2::aes(long, lat, group = group), ...) - - return(p) - -} diff --git a/R/update.R b/R/update.R index 0500de4a..b4d0a47d 100644 --- a/R/update.R +++ b/R/update.R @@ -24,7 +24,6 @@ get_update <- function(links) { #' @seealso \code{\link{get_update}} #' @keywords internal update <- function(contents) { - status <- scrape_header( contents = contents, ptn_product_title = "(?:UPDATE )?", @@ -36,11 +35,10 @@ update <- function(contents) { key <- scrape_key(contents) tibble::tibble( - Status = status[,1], - Name = status[,2], + Status = status[, 1], + Name = status[, 2], Date = issue_date, Key = key, Contents = contents ) - } diff --git a/R/wndprb.R b/R/wndprb.R index 7058370d..c1c1f7b1 100644 --- a/R/wndprb.R +++ b/R/wndprb.R @@ -123,9 +123,10 @@ parse_stations <- function(x) { df <- readLines(x) %>% tibble::as_tibble() %>% tidyr::separate(.data$value, - c("X1", "Location", "Lat", "Lon", "X5", "X6", "X7"), - sep = ",", - extra = "warn") %>% + c("X1", "Location", "Lat", "Lon", "X5", "X6", "X7"), + sep = ",", + extra = "warn" + ) %>% dplyr::arrange(.data$Location) return(df) } @@ -137,7 +138,6 @@ parse_stations <- function(x) { #' @param contents Link to a storm's specific wind probability product. #' @keywords internal wndprb <- function(contents) { - status <- scrape_header( contents = contents, # The "SPECIAL" pattern has to be left here; moving it under @@ -149,51 +149,53 @@ wndprb <- function(contents) { key <- scrape_key(contents) - ptn <- stringr::str_c("(?<=\n)", # Look-behind - # Location - first value must be capital letter. - "([:upper:]{1}[[:alnum:][:blank:][:punct:]]{14})", - # Wind - "([[:digit:]]{2})", - # Wind12 - "[:blank:]+([:digit:]{1,2}|X)", - # Delim - "[:blank:]+", - # Wind24 - "([:digit:]{1,2}|X)", - # Wind24 cumulative - "+\\([:blank:]*([:digit:]{1,2}|X)\\)", - # Delim - "[:blank:]+", - # Wind36 - "([:digit:]{1,2}|X)", - # Wind36 cumulative - "+\\([:blank:]*([:digit:]{1,2}|X)\\)", - # Delim - "[:blank:]+", - # Wind48 - "([:digit:]{1,2}|X)", - # Wind48 cumulative - "+\\([:blank:]*([:digit:]{1,2}|X)\\)", - # Delim - "[:blank:]+", - # Wind72 - "([:digit:]{1,2}|X)", - # Wind72 cumulative - "+\\([:blank:]*([:digit:]{1,2}|X)\\)", - # Delim - "[:blank:]+", - # Wind96 - "([:digit:]{1,2}|X)", - # Wind96 cumulative - "+\\([:blank:]*([:digit:]{1,2}|X)\\)", - # Delim - "[:blank:]+", - # Wind120 - "([:digit:]{1,2}|X)", - # Wind120 cumulative - "+\\([:blank:]*([:digit:]{1,2}|X)\\)", - # End - "[[:blank:]\n]+") + ptn <- stringr::str_c( + "(?<=\n)", # Look-behind + # Location - first value must be capital letter. + "([:upper:]{1}[[:alnum:][:blank:][:punct:]]{14})", + # Wind + "([[:digit:]]{2})", + # Wind12 + "[:blank:]+([:digit:]{1,2}|X)", + # Delim + "[:blank:]+", + # Wind24 + "([:digit:]{1,2}|X)", + # Wind24 cumulative + "+\\([:blank:]*([:digit:]{1,2}|X)\\)", + # Delim + "[:blank:]+", + # Wind36 + "([:digit:]{1,2}|X)", + # Wind36 cumulative + "+\\([:blank:]*([:digit:]{1,2}|X)\\)", + # Delim + "[:blank:]+", + # Wind48 + "([:digit:]{1,2}|X)", + # Wind48 cumulative + "+\\([:blank:]*([:digit:]{1,2}|X)\\)", + # Delim + "[:blank:]+", + # Wind72 + "([:digit:]{1,2}|X)", + # Wind72 cumulative + "+\\([:blank:]*([:digit:]{1,2}|X)\\)", + # Delim + "[:blank:]+", + # Wind96 + "([:digit:]{1,2}|X)", + # Wind96 cumulative + "+\\([:blank:]*([:digit:]{1,2}|X)\\)", + # Delim + "[:blank:]+", + # Wind120 + "([:digit:]{1,2}|X)", + # Wind120 cumulative + "+\\([:blank:]*([:digit:]{1,2}|X)\\)", + # End + "[[:blank:]\n]+" + ) wndprb <- contents %>% @@ -201,13 +203,15 @@ wndprb <- function(contents) { purrr::map(tibble::as_tibble, .name_repair = "minimal") %>% purrr::map( .f = rlang::set_names, - nm = c("X1", "Location", "Wind", "Wind12", "Wind24", "Wind24Cum", - "Wind36", "Wind36Cum", "Wind48", "Wind48Cum", "Wind72", - "Wind72Cum", "Wind96", "Wind96Cum", "Wind120", "Wind120Cum") + nm = c( + "X1", "Location", "Wind", "Wind12", "Wind24", "Wind24Cum", + "Wind36", "Wind36Cum", "Wind48", "Wind48Cum", "Wind72", + "Wind72Cum", "Wind96", "Wind96Cum", "Wind120", "Wind120Cum" + ) ) %>% - purrr::map2(key, ~tibble::add_column(.x, Key = .y, .before = 1)) %>% - purrr::map2(status[,3], ~tibble::add_column(.x, Adv = .y, .after = 2)) %>% - purrr::map2(issue_date, ~tibble::add_column(.x, Date = .y, .after = 3)) %>% + purrr::map2(key, ~ tibble::add_column(.x, Key = .y, .before = 1)) %>% + purrr::map2(status[, 3], ~ tibble::add_column(.x, Adv = .y, .after = 2)) %>% + purrr::map2(issue_date, ~ tibble::add_column(.x, Date = .y, .after = 3)) %>% purrr::map_df(tibble::as_tibble) %>% dplyr::select(-c("X1")) %>% # Trim whitespace @@ -228,5 +232,4 @@ wndprb <- function(contents) { .vars = c(2, 5:18), .funs = "as.numeric" ) - } diff --git a/README.Rmd b/README.Rmd index 360bc0bd..7173f1bf 100644 --- a/README.Rmd +++ b/README.Rmd @@ -6,9 +6,11 @@ output: github_document [![GitHub (pre-)release](https://img.shields.io/github/release/ropensci/rrricanes/all.svg)](https://github.com/ropensci/rrricanes/tags) [![](https://badges.ropensci.org/118_status.svg)](https://github.com/ropensci/onboarding/issues/118) [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/rrricanes)](https://cran.r-project.org/package=rrricanes) -[![Build Status](https://img.shields.io/travis/ropensci/rrricanes/master.svg)](https://travis-ci.org/ropensci/rrricanes) +[![Travis Build Status](https://img.shields.io/travis/ropensci/rrricanes/master.svg)](https://travis-ci.org/ropensci/rrricanes) [![AppVeyor Build Status](https://img.shields.io/appveyor/ci/timtrice/rrricanes-g4dos/master.svg)](https://ci.appveyor.com/project/timtrice/rrricanes-g4dos) +[![Docker Build Status](https://img.shields.io/docker/cloud/build/timtrice/rrricanes.svg?style=popout)](https://cloud.docker.com/repository/docker/timtrice/rrricanes) [![codecov](https://codecov.io/gh/ropensci/rrricanes/branch/master/graph/badge.svg)](https://codecov.io/gh/ropensci/rrricanes) +[![Launch rstudio.cloud](https://img.shields.io/badge/launch-rstudio.cloud-yellowgreen.svg)](https://rstudio.cloud/project/400381) ```{r, echo = FALSE} knitr::opts_chunk$set( @@ -18,7 +20,9 @@ knitr::opts_chunk$set( ) ``` -# rrricanes +# rrricanes (`r desc::desc_get_version() `) + +## `r desc::desc_get_field("Title")` `rrricanes` is a R library that extracts information from [available archives](http://www.nhc.noaa.gov/archive/1998/1998archive.shtml) on past and current tropical cyclones. Currently, archives date back to 1998. @@ -30,9 +34,7 @@ This library parses the text advisories of all tropical cyclones since 1998. Ove I wrote this package with the goal of consolidating messy text data into well-organized formats that can easily be saved to CSV, SQL and other data formats. -You may explore some features of the package through the [shinycanes](https://timtrice.shinyapps.io/shinycanes/) beta web application (built with R Shiny). - -## Advisory Products +### Advisory Products Generally speaking, there are five products available for tropical cyclones issued at 03:00, 09:00, 15:00 and 21:00 UTC; @@ -54,7 +56,7 @@ These products are included in the package though they have been discontinued at 2. Position Estimates - Typically issued as a storm is threatening land but generally rare (see Hurricane Ike 2008, Key AL092008). It is generally just an update of the current location of the cyclone. After the 2011 hurricane season, this product was discontinued; Updates are now issued in their place. -## Getting Started +### Getting Started Please view the vignette 'Getting Started': @@ -64,7 +66,7 @@ vignette("getting_started", package = "rrricanes") [Online documentation](https://timtrice.github.io/rrricanes/) is also available. -### Prerequisites +#### Prerequisites `rrricanes` requires an active internet connection as data is extracted from online sources. @@ -73,20 +75,16 @@ Linux users must also have the `libgdal-dev`, `libproj-dev` and `libxml2-dev` pa To add `rrricanesdata`, a [package of post-scraped datasets](https://github.com/ropensci/rrricanesdata), ```r -install.packages("rrricanesdata", - repos = "https://timtrice.github.io/drat/", - type = "source") +remotes::install_github("ropensci/rrricanesdata") ``` To use high resolution tracking maps you will need to install the `rnaturalearthhires` package. ```r -install.packages("rnaturalearthhires", - repos = "http://packages.ropensci.org", - type = "source") +remotes::install_github("ropensci/rnaturalearthhires") ``` -### Installing +#### Installing `rrricanes` is currently only available in GitHub. It can be installed using the `devtools` package: @@ -94,29 +92,29 @@ install.packages("rnaturalearthhires", devtools::install_github("ropensci/rrricanes", build_vignettes = TRUE) ``` -## Built With +### Built With -* [R 3.3.3](https://www.r-project.org/) - The R Project for Statistical Computing +* [R 3.5.0](https://www.r-project.org/) - The R Project for Statistical Computing -## Contributing +### Contributing Please read [CONTRIBUTING.md](https://github.com/ropensci/rrricanes/blob/master/.github/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. -## Versioning +### Versioning We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/ropensci/rrricanes/tags). -## Authors +### Authors * **Tim Trice** - *Initial work* - [timtrice](https://github.com/timtrice) See also the list of [contributors](https://github.com/ropensci/rrricanes/contributors) who participated in this project. -## License +### License This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details -## Acknowledgments +### Acknowledgments * [Molyneux, James](https://github.com/jimmylovestea) * [Padgham, Mark](https://github.com/mpadge) @@ -125,6 +123,8 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md * [Salmon, Maëlle](https://github.com/maelle) * [Stachelek, Joseph](https://github.com/jsta) -## Known Data Quality Issues +### Known Data Quality Issues 1. Hurricane Juan (AL152003), Adv 15; no status leads to improper `Status` and `Name` values in some datasets. ([#82](https://github.com/ropensci/rrricanes/issues/82)) + +
[![](http://ropensci.org/public_images/github_footer.png)](http://ropensci.org)
diff --git a/README.md b/README.md index d6a0a870..b5927339 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,19 @@ version](https://img.shields.io/badge/R%3E%3D-3.5.0-6666ff.svg)](https://cran.r- (pre-)release](https://img.shields.io/github/release/ropensci/rrricanes/all.svg)](https://github.com/ropensci/rrricanes/tags) [![](https://badges.ropensci.org/118_status.svg)](https://github.com/ropensci/onboarding/issues/118) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/rrricanes)](https://cran.r-project.org/package=rrricanes) -[![Build +[![Travis Build Status](https://img.shields.io/travis/ropensci/rrricanes/master.svg)](https://travis-ci.org/ropensci/rrricanes) [![AppVeyor Build Status](https://img.shields.io/appveyor/ci/timtrice/rrricanes-g4dos/master.svg)](https://ci.appveyor.com/project/timtrice/rrricanes-g4dos) +[![Docker Build +Status](https://img.shields.io/docker/cloud/build/timtrice/rrricanes.svg?style=popout)](https://cloud.docker.com/repository/docker/timtrice/rrricanes) [![codecov](https://codecov.io/gh/ropensci/rrricanes/branch/master/graph/badge.svg)](https://codecov.io/gh/ropensci/rrricanes) +[![Launch +rstudio.cloud](https://img.shields.io/badge/launch-rstudio.cloud-yellowgreen.svg)](https://rstudio.cloud/project/400381) -# rrricanes +# rrricanes (0.2.0.6.9002) + +## Web scraper for Atlantic and east Pacific hurricanes and tropical storms `rrricanes` is a R library that extracts information from [available archives](http://www.nhc.noaa.gov/archive/1998/1998archive.shtml) on @@ -35,11 +41,7 @@ I wrote this package with the goal of consolidating messy text data into well-organized formats that can easily be saved to CSV, SQL and other data formats. -You may explore some features of the package through the -[shinycanes](https://timtrice.shinyapps.io/shinycanes/) beta web -application (built with R Shiny). - -## Advisory Products +### Advisory Products Generally speaking, there are five products available for tropical cyclones issued at 03:00, 09:00, 15:00 and 21:00 UTC; @@ -85,7 +87,7 @@ discontinued at some point: After the 2011 hurricane season, this product was discontinued; Updates are now issued in their place. -## Getting Started +### Getting Started Please view the vignette ‘Getting Started’: @@ -96,7 +98,7 @@ vignette("getting_started", package = "rrricanes") [Online documentation](https://timtrice.github.io/rrricanes/) is also available. -### Prerequisites +#### Prerequisites `rrricanes` requires an active internet connection as data is extracted from online sources. @@ -108,21 +110,17 @@ To add `rrricanesdata`, a [package of post-scraped datasets](https://github.com/ropensci/rrricanesdata), ``` r -install.packages("rrricanesdata", - repos = "https://timtrice.github.io/drat/", - type = "source") +remotes::install_github("ropensci/rrricanesdata") ``` To use high resolution tracking maps you will need to install the `rnaturalearthhires` package. ``` r -install.packages("rnaturalearthhires", - repos = "http://packages.ropensci.org", - type = "source") +remotes::install_github("ropensci/rnaturalearthhires") ``` -### Installing +#### Installing `rrricanes` is currently only available in GitHub. It can be installed using the `devtools` package: @@ -131,25 +129,25 @@ using the `devtools` package: devtools::install_github("ropensci/rrricanes", build_vignettes = TRUE) ``` -## Built With +### Built With - - [R 3.3.3](https://www.r-project.org/) - The R Project for + - [R 3.5.0](https://www.r-project.org/) - The R Project for Statistical Computing -## Contributing +### Contributing Please read [CONTRIBUTING.md](https://github.com/ropensci/rrricanes/blob/master/.github/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. -## Versioning +### Versioning We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/ropensci/rrricanes/tags). -## Authors +### Authors - **Tim Trice** - *Initial work* - [timtrice](https://github.com/timtrice) @@ -158,12 +156,12 @@ See also the list of [contributors](https://github.com/ropensci/rrricanes/contributors) who participated in this project. -## License +### License This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details -## Acknowledgments +### Acknowledgments - [Molyneux, James](https://github.com/jimmylovestea) - [Padgham, Mark](https://github.com/mpadge) @@ -172,8 +170,14 @@ This project is licensed under the MIT License - see the - [Salmon, Maëlle](https://github.com/maelle) - [Stachelek, Joseph](https://github.com/jsta) -## Known Data Quality Issues +### Known Data Quality Issues 1. Hurricane Juan (AL152003), Adv 15; no status leads to improper `Status` and `Name` values in some datasets. ([\#82](https://github.com/ropensci/rrricanes/issues/82)) + +
+ +[![](http://ropensci.org/public_images/github_footer.png)](http://ropensci.org) + +
diff --git a/_pkgdown.yml b/_pkgdown.yml index b2fec146..c805c84d 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,39 @@ url: https://ropensci.github.io/rrricanes/ +toc: + depth: 3 + +authors: + Tim Trice: + href: https://timtrice.net + +template: + params: + docsearch: + api_key: 5aeb8a5c28f12c523e08f69cf1aab431 + index_name: rrricanes + ganalytics: UA-1507390-27 + +navbar: + type: default + left: + - icon: fa-home fa-lg + href: index.html + - text: Getting Started + href: articles/getting_started.html + - text: Reference + href: reference/index.html + - text: Tutorials + menu: + - text: Accumulated Cyclone Energy + href: articles/accumulated_cyclone_energy.html + - text: GIS Data + href: articles/gis_data.html + - text: Wind and Pressure + href: articles/wind_pressure.html + - text: rrricanesdata + href: articles/installing_rrricanesdata.html + - text: "News" + href: news/index.html reference: - title: About `rrricanes` @@ -14,17 +49,10 @@ reference: contents: - twoal - twoep - - title: Tracking charts - desc: Helper functions to plot storm data through `ggplot2`. - contents: - - al_tracking_chart - - ep_tracking_chart - - tracking_chart - title: GIS Data desc: Gathering GIS data from the National Hurricane Center. contents: - starts_with("gis_") - - shp_to_df - title: Helpers desc: > Helper functions. Please note `al_prblty_stations` and @@ -52,6 +80,7 @@ reference: - df.gis_storm_surge - df.gis_wind_radii - df.gis_wsp +<<<<<<< HEAD articles: - title: Articles @@ -74,3 +103,5 @@ extra_packages: # Temp workaround for ragg/gganimate problem figures: dev: grDevices::png +======= +>>>>>>> 77991c4d27277d70396af597475ea5480bc3b42c diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..7568e9eb --- /dev/null +++ b/codecov.yml @@ -0,0 +1,12 @@ +comment: false + +coverage: + status: + patch: + default: + target: 0 + threshold: 100 + project: + default: + target: 70 + threshold: 100 diff --git a/data-raw/audit.R b/data-raw/audit.R deleted file mode 100644 index 07542ccc..00000000 --- a/data-raw/audit.R +++ /dev/null @@ -1,248 +0,0 @@ -#' ########################################################################## '# -#' Audit -#' -#' Examine all datasets for quality issues. This will primarily be beneficial -#' during cleanup phases but should probably be operated on a weekly basis to -#' ensure integrity. -#' -#' ########################################################################## '# - -## ---- Libraries -------------------------------------------------------------- -library(dplyr) -library(Hmisc) -library(purrr) -library(readr) -library(rrricanes) - -## ---- Options ---------------------------------------------------------------- - -## ---- Variables -------------------------------------------------------------- -valid_options <- c("Hurricane", "Post-Tropical Cyclone", - "Potential Tropical Cyclone", "Remnants of", - "Subtropical Depression", "Tropical Depression", - "Tropical Storm") - -invalid_names <- c("Center", "Test") - -#' ########################################################################## '# -## ---- Storm Discussions ------------------------------------------------------ -#' The `discus` product should only parse `status`, `name`, `adv`, `date` and -#' `contents` of the product. -discus <- read_csv("./datasets/discus.csv", col_types = cols()) - -## ---- * Status --------------------------------------------------------------- -status <- sort(unique(discus$Status)) -if (!(any(status %in% valid_options))) - warning(sprintf("Invalid Status in discus:\n%s", - sort(unique(discus$Status[!(discus$Status %in% valid_options)])))) - -## ---- * Names ---------------------------------------------------------------- -#' * discus$Name for EP192000 Adv 1 is "Test". This is an err on the NHC's part. -discus_names <- sort(unique(discus$Name)) -if (any(discus_names %in% invalid_names)) { - warning("Invalid Names in discus. See object df_discus_invalid_names.") - df_discus_invalid_names <- discus %>% filter(Name %in% invalid_names) -} - -## ---- * Adv ------------------------------------------------------------------ -describe(discus$Adv) - -## ---- * Date ----------------------------------------------------------------- -describe(discus$Date) - -#' ########################################################################## '# -## ---- Forecast/Advisory ------------------------------------------------------ -fstadv <- read_csv("./datasets/fstadv.csv", col_types = cols(), - guess_max = 13000) - -## ---- * Status --------------------------------------------------------------- -status <- sort(unique(fstadv$Status)) -if (!(any(status %in% valid_options))) - warning(sprintf("Invalid Status in fstadv:\n%s", - sort(unique(fstadv$Status[!(fstadv$Status %in% valid_options)])))) - -## ---- * Names ---------------------------------------------------------------- -fstadv_names <- sort(unique(fstadv$Name)) -if (any(fstadv_names %in% invalid_names)) { - warning("Invalid Names in fstadv. See object df_fstadv_invalid_names.") - df_fstadv_invalid_names <- fstadv %>% filter(Name %in% invalid_names) -} - -## ---- * Date ----------------------------------------------------------------- -describe(fstadv$Date) - -## ---- * Key ------------------------------------------------------------------ -if (any(grepl("^[AL|EP][[:digit:]]{6}$", fstadv$Key))) - warning("Invalid Keys") - -## ---- * Lat ------------------------------------------------------------------ -#' There may be NA values in Lat if a system is no longer tropical or has a -#' closed center. -fstadv_lat <- select(fstadv, dplyr::contains("Lat")) - -if (!every(fstadv_lat, is.double)) - warning("Non-numeric lat values") - -if (min(fstadv_lat, na.rm = TRUE) < 0 | max(fstadv_lat, na.rm = TRUE) > 90) - warning("Possible invalid latitude values") - -## ---- * Lon ------------------------------------------------------------------ -#' There may be NA values in Lon if a system is no longer tropical or has a -#' closed center. -fstadv_lon <- select(fstadv, dplyr::contains("Lon")) - -if (!every(fstadv_lon, is.double)) - warning("Non-numeric lon values") - -if (min(fstadv_lon, na.rm = TRUE) < -180 | max(fstadv_lon, na.rm = TRUE) > 180) - warning("Possible invalid longitude values") - -## ---- * Wind, Gust ----------------------------------------------------------- -fstadv_winds <- select(fstadv, ends_with("Wind"), ends_with("Gust")) - -if (!every(fstadv_winds, is.numeric)) - warning("Non-numeric wind/gust values") - -## ---- * Pressure ------------------------------------------------------------- -if (!is.numeric(fstadv$Pressure)) - warning("Non-numeric values in Pressure") - -## ---- * PosAcc --------------------------------------------------------------- -if (!is.numeric(fstadv$PosAcc)) - warning("Non-numeric values in PosAcc") - -## ---- * FwdDir --------------------------------------------------------------- -if (!is.numeric(fstadv$FwdDir)) - warning("Non-numeric values in FwdDir") - -## ---- * FwdDir --------------------------------------------------------------- -if (!is.numeric(fstadv$FwdDir)) - warning("Non-numeric values in FwdDir") - -## ---- * FwdSpeed ------------------------------------------------------------- -if (!is.numeric(fstadv$FwdSpeed)) - warning("Non-numeric values in FwdSpeed") - -## ---- * Eye ------------------------------------------------------------------ -if (!is.numeric(fstadv$Eye)) - warning("Non-numeric values in Eye") - -## ---- * Wind Radii ----------------------------------------------------------- -#' Convert to numeric, if not, which sould generate error if non-numeric values -#' exist. -fstadv_wr <- fstadv %>% select(matches(".[NE|SE|SW|NW][34|50|64].")) %>% - map_df(as.numeric) - -#' Forecast hours 48 and 72 should not have 64kt wind radius fields -is_empty(select(fstadv, Hr48NE64:Hr48NW64, Hr72NE64:Hr72NW64) %>% describe()) - -#' Forecast hours 96 and 120 should not have any wind radius fields -is_empty(select(fstadv, Hr96NE64:Hr96NW34, Hr120NE64:Hr120NW34) %>% describe()) - -#' ########################################################################## '# -## ---- Position Estimates ----------------------------------------------------- -posest <- read_csv("./datasets/posest.csv", col_types = cols()) - -## ---- * Status --------------------------------------------------------------- -status <- sort(unique(posest$Status)) -if (!(any(status %in% valid_options))) - warning(sprintf("Invalid Status in posest:\n%s", - sort(unique(posest$Status[!(posest$Status %in% valid_options)])))) - -## ---- * Names ---------------------------------------------------------------- -posest_names <- sort(unique(posest$Name)) -if (any(posest_names %in% invalid_names)) { - warning("Invalid Names in posest. See object df_posest_invalid_names.") - df_posest_invalid_names <- posest %>% filter(Name %in% invalid_names) -} - -## ---- * Date ----------------------------------------------------------------- -describe(posest$Date) - -#' ########################################################################## '# -## ---- Strike Probabilities --------------------------------------------------- -prblty <- read_csv("./datasets/prblty.csv", col_types = cols()) - -## ---- * Status --------------------------------------------------------------- -status <- sort(unique(prblty$Status)) -if (!(any(status %in% valid_options))) - warning(sprintf("Invalid Status in prblty:\n%s", - sort(unique(prblty$Status[!(prblty$Status %in% valid_options)])))) - -## ---- * Names ---------------------------------------------------------------- -#' * prblty$Name for AL161999 Adv 1 is "Test". This is an err on the NHC's part. -prblty_names <- sort(unique(prblty$Name)) -if (any(prblty_names %in% invalid_names)) { - warning("Invalid Names in prblty. See object df_prblty_invalid_names.") - df_prblty_invalid_names <- prblty %>% filter(Name %in% invalid_names) -} - -## ---- * Wind:Wind120Cum ------------------------------------------------------ -if (!every(prblty %>% select(A:E), is.numeric)) - warning("Some probability cols not numeric.") - -#' ########################################################################## '# -## ---- Public Advisories ------------------------------------------------------ -public <- read_csv("./datasets/public.csv", col_types = cols()) - -## ---- * Status --------------------------------------------------------------- -status <- sort(unique(public$Status)) -if (!(any(status %in% valid_options))) - warning(sprintf("Invalid Status in public:\n%s", - sort(unique(public$Status[!(public$Status %in% valid_options)])))) - -## ---- * Names ---------------------------------------------------------------- -public_names <- sort(unique(public$Name)) -if (any(public_names %in% invalid_names)) { - warning("Invalid Names in public. See object df_public_invalid_names.") - df_public_invalid_names <- public %>% filter(Name %in% invalid_names) -} - -## ---- * Adv ------------------------------------------------------------------ -describe(public$Adv) -if (any(is.na(public$Adv))) { - warning("Adv contains NA values.") - df_public_invalid_adv <- public %>% filter(is.na(Adv)) -} - -## ---- * Date ----------------------------------------------------------------- -describe(public$Date) - -#' ########################################################################## '# -## ---- Updates ---------------------------------------------------------------- -update <- read_csv("./datasets/update.csv", col_types = cols()) - -## ---- * Status --------------------------------------------------------------- -status <- sort(unique(update$Status)) -if (!(any(status %in% valid_options))) - warning(sprintf("Invalid Status in update:\n%s", - sort(unique(update$Status[!(update$Status %in% valid_options)])))) - -## ---- * Names ---------------------------------------------------------------- -update_names <- sort(unique(update$Name)) -if (any(update_names %in% invalid_names)) { - warning("Invalid Names in update. See object df_update_invalid_names.") - df_update_invalid_names <- update %>% filter(Name %in% invalid_names) -} - -#' ########################################################################## '# -## ---- Wind speed Probabilities ----------------------------------------------- -wndprb <- read_csv("./datasets/wndprb.csv", col_types = cols()) - -## ---- * Key ------------------------------------------------------------------ -if (any(grepl("^[AL|EP][[:digit:]]{6}$", wndprb$Key))) - warning("Invalid Keys") - -## ---- * Adv ------------------------------------------------------------------ -describe(wndprb$Adv) -if (any(is.na(wndprb$Adv))) { - warning("Adv contains NA values.") - df_wndprb_invalid_adv <- wndprb %>% filter(is.na(Adv)) -} - -## ---- * Date ----------------------------------------------------------------- -describe(wndprb$Date) - -## ---- * Wind:Wind120Cum ------------------------------------------------------ -if (!every(wndprb %>% select(Wind:Wind120Cum), is.numeric)) - warning("Some Wind cols not numeric.") diff --git a/data-raw/build_scraped_datasets.R b/data-raw/build_scraped_datasets.R deleted file mode 100644 index bc6cff8e..00000000 --- a/data-raw/build_scraped_datasets.R +++ /dev/null @@ -1,143 +0,0 @@ -#' ########################################################################## '# -#' build_scraped_datasets -#' -#' Run script to build full datasets for all products. Should only be run after -#' major revisions to the packages product functions output. -#' -#' ########################################################################## '# - -## ---- Libraries -------------------------------------------------------------- -library(dplyr) -library(purrr) -library(readr) -library(rrricanes) - -## ---- Variables -------------------------------------------------------------- -basins <- c("AL", "EP") -years <- 1998:2017 -products <- c("discus", "fstadv", "posest", "prblty", "public", "update", - "wndprb") - -## ---- Get Storms ------------------------------------------------------------- -storms <- map_df(years, .f = function(year) { - map_df(basins, .f = function(basin) { - get_storms(year = year, basin = basin) - }) -}) - -## ---- Storm Discussions ------------------------------------------------------ -discus <- map_df(storms %>% .$Link, .f = function(storm_link) { - safely_get_discus <- purrr::safely(get_discus) - df <- safely_get_discus(link = storm_link) - if (is.null(df$error)) { - return(df$result) - } else { - write(sprintf("Storm Discussion error: %s\n%s", df$error, storm_link), - file = "log.txt", - append = TRUE) - } -}) - -write_csv(discus, "./datasets/discus.csv") - -## ---- Forecast/Advisory ------------------------------------------------------ -fstadv <- map_df(storms %>% .$Link, .f = function(storm_link) { - safely_get_fstadv <- purrr::safely(get_fstadv) - df <- safely_get_fstadv(link = storm_link) - if (is.null(df$error)) { - return(df$result) - } else { - write(sprintf("Forecast/Advisory error: %s\n%s", df$error, storm_link), - file = "log.txt", - append = TRUE) - } -}) - -write_csv(fstadv, "./datasets/fstadv.csv") - -adv <- tidy_fstadv(fstadv) -write_csv(adv, "./datasets/adv.csv") - -fcst <- tidy_fcst(fstadv) -write_csv(fcst, "./datasets/fcst.csv") - -wr <- tidy_wr(fstadv) -write_csv(wr, "./datasets/wr.csv") - -fcst_wr <- tidy_fcst_wr(fstadv) -write_csv(fcst_wr, "./datasets/fcst_wr.csv") - -## ---- Position Estimates ----------------------------------------------------- -posest <- map_df(storms %>% .$Link, .f = function(storm_link) { - safely_get_posest <- purrr::safely(get_posest) - df <- safely_get_posest(link = storm_link) - if (is.null(df$error)) { - return(df$result) - } else { - write(sprintf("Position Estimate error: %s\n%s", df$error, storm_link), - file = "log.txt", - append = TRUE) - } -}) - -write_csv(posest, "./datasets/posest.csv") - -## ---- Strike Probabilities --------------------------------------------------- -prblty <- map_df(storms %>% .$Link, .f = function(storm_link) { - safely_get_prblty <- purrr::safely(get_prblty) - df <- safely_get_prblty(link = storm_link) - if (is.null(df$error)) { - return(df$result) - } else { - write(sprintf("Strike Probabilities error: %s\n%s", df$error, storm_link), - file = "log.txt", - append = TRUE) - } -}) - -write_csv(prblty, "./datasets/prblty.csv") - -## ---- Public Advisories ------------------------------------------------------ -public <- map_df(storms %>% .$Link, .f = function(storm_link) { - safely_get_public <- purrr::safely(get_public) - df <- safely_get_public(link = storm_link) - if (is.null(df$error)) { - return(df$result) - } else { - write(sprintf("Public Advisory error: %s\n%s", df$error, storm_link), - file = "log.txt", - append = TRUE) - } -}) - -write_csv(public, "./datasets/public.csv") - -## ---- Updates ---------------------------------------------------------------- -update <- map_df(storms %>% .$Link, .f = function(storm_link) { - safely_get_update <- purrr::safely(get_update) - df <- safely_get_update(link = storm_link) - if (is.null(df$error)) { - return(df$result) - } else { - write(sprintf("Update error: %s\n%s", df$error, storm_link), - file = "log.txt", - append = TRUE) - } -}) - -write_csv(update, "./datasets/update.csv") - -## ---- Wind Speed Probabilities ----------------------------------------------- -wndprb <- map_df(storms %>% .$Link, .f = function(storm_link) { - safely_get_wndprb <- purrr::safely(get_wndprb) - df <- safely_get_wndprb(link = storm_link) - if (is.null(df$error)) { - return(df$result) - } else { - write(sprintf("Wind Probabilities error: %s\n%s", df$error, storm_link), - file = "log.txt", - append = TRUE) - } -}) - -write_csv(wndprb, "./datasets/wndprb.csv") diff --git a/data-raw/build_test_dataframes.R b/data-raw/build_test_dataframes.R index df21130f..f1dafb76 100644 --- a/data-raw/build_test_dataframes.R +++ b/data-raw/build_test_dataframes.R @@ -7,32 +7,32 @@ al_2008 <- get_storms(years = 2008, basins = "AL") al_2017 <- get_storms(years = 2017, basins = "AL") al_01_2017_products <- get_storm_data( - links = al_2017[[1,4]], - products = c("discus", "fstadv") + links = al_2017[[1, 4]], + products = c("discus", "fstadv") ) -al_09_2008_discus <- get_discus(al_2008[[9,4]]) +al_09_2008_discus <- get_discus(al_2008[[9, 4]]) -al_09_2008_fstadv <- get_fstadv(al_2008[[9,4]]) +al_09_2008_fstadv <- get_fstadv(al_2008[[9, 4]]) -al_09_2008_posest <- get_posest(al_2008[[9,4]]) +al_09_2008_posest <- get_posest(al_2008[[9, 4]]) -al_01_1998_prblty <- get_prblty(al_1998[[1,4]]) +al_01_1998_prblty <- get_prblty(al_1998[[1, 4]]) -al_09_2008_public <- get_public(al_2008[[9,4]]) +al_09_2008_public <- get_public(al_2008[[9, 4]]) -al_09_2008_update <- get_update(al_2008[[9,4]]) +al_09_2008_update <- get_update(al_2008[[9, 4]]) -al_09_2008_wndprb <- get_wndprb(al_2008[[9,4]]) +al_09_2008_wndprb <- get_wndprb(al_2008[[9, 4]]) save( - al_01_1998_prblty, - al_01_2017_products, - al_09_2008_discus, - al_09_2008_fstadv, - al_09_2008_posest, - al_09_2008_public, - al_09_2008_update, - al_09_2008_wndprb, - file = ("./inst/extdata/tests_datasets.RData") + al_01_1998_prblty, + al_01_2017_products, + al_09_2008_discus, + al_09_2008_fstadv, + al_09_2008_posest, + al_09_2008_public, + al_09_2008_update, + al_09_2008_wndprb, + file = ("./inst/extdata/tests_datasets.RData") ) diff --git a/data-raw/build_vignette_datasets.R b/data-raw/build_vignette_datasets.R index dbb80b9c..e75fc886 100644 --- a/data-raw/build_vignette_datasets.R +++ b/data-raw/build_vignette_datasets.R @@ -8,51 +8,53 @@ library(rrricanes) df.al_2012 <- get_storms(year = 2012, basin = "AL") df.al_18_2012_fstadv <- df.al_2012 %>% - filter(Name == "Hurricane Sandy") %>% - .$Link %>% - get_fstadv() + filter(Name == "Hurricane Sandy") %>% + .$Link %>% + get_fstadv() df.al_18_2012 <- df.al_2012 %>% - filter(Name == "Hurricane Sandy") %>% - .$Link %>% - get_storm_data(c("fstadv", "wndprb")) + filter(Name == "Hurricane Sandy") %>% + .$Link %>% + get_storm_data(c("fstadv", "wndprb")) df.al_12_2005_prblty <- get_storms(year = 2005, basin = "AL") %>% - filter(Name == "Hurricane Katrina") %>% - .$Link %>% - get_prblty() + filter(Name == "Hurricane Katrina") %>% + .$Link %>% + get_prblty() df.al_18_2012_wndprb <- df.al_2012 %>% - filter(Name == "Hurricane Sandy") %>% - .$Link %>% - get_wndprb() + filter(Name == "Hurricane Sandy") %>% + .$Link %>% + get_wndprb() usethis::use_data( - df.al_2012, - df.al_18_2012_fstadv, - df.al_18_2012, - df.al_12_2005_prblty, - df.al_18_2012_wndprb, - overwrite = TRUE + df.al_2012, + df.al_18_2012_fstadv, + df.al_18_2012, + df.al_12_2005_prblty, + df.al_18_2012_wndprb, + overwrite = TRUE ) ## ---- GIS Data --------------------------------------------------------------- df.gis_adv <- gis_advisory(key = "AL182012", advisory = "18") %>% gis_download() -df.gis_storm_surge <- gis_prob_storm_surge(key = "AL142016", - products = list(psurge = 0), - datetime = "20161006") %>% - last() %>% - gis_download() +df.gis_storm_surge <- gis_prob_storm_surge( + key = "AL142016", + products = list(psurge = 0), + datetime = "20161006" +) %>% + last() %>% + gis_download() df.gis_wind_radii <- gis_windfield("AL142016", advisory = "33") %>% gis_download() df.gis_wsp <- gis_wsp(datetime = "2016100606", res = 0.5) %>% gis_download() usethis::use_data( - df.gis_adv, - df.gis_storm_surge, - df.gis_wind_radii, - df.gis_wsp, - overwrite = TRUE + df.gis_adv, + df.gis_storm_surge, + df.gis_wind_radii, + df.gis_wsp, + overwrite = TRUE ) diff --git a/data-raw/fetch_products.R b/data-raw/fetch_products.R deleted file mode 100644 index e578a02e..00000000 --- a/data-raw/fetch_products.R +++ /dev/null @@ -1,232 +0,0 @@ -#'----------------------------------------------------------------------------'# -#' '# -#' Fetch Products '# -#' '# -#'----------------------------------------------------------------------------'# -#' -#' Scrape basin index xml files for active storms. If no storms are present, -#' exit script. -#' -#' If storms do exist, extract wallet ID for each storm. -#' -#' In file pub_dates.csv exists each wallet id for each basin along with the -#' last published date processed. If each product in each active wallet has a -#' pubDate greater than the value in pub_dates.csv, parse product, add to -#' product dataframe and push to GitHub repo. -#' -#' This script need not run on a consistent basis but, for the time being, will -#' have to be micromanaged somewhat. If there is no possibility of a storm -#' developing within the next 24-48 hours, then no need to run. -#' -#' However, if there is, say, >50% chance of development then the script should -#' probably run every 10-15 minutes. -#' -#' Execution: -#' R CMD BATCH R/fetch_products.R - -## ---- Libraries -------------------------------------------------------------- -library(dplyr) -library(git2r) -library(purrr) -library(readr) -library(rrricanes) -library(rvest) -library(sendmailR) -library(stringr) -library(tibble) -library(xml2) - -## ---- Options ---------------------------------------------------------------- -opts.working_msg <- getOption("rrricanes.working_msg") -options("rrricanes.working_msg" = TRUE) - -# Change working directory -wd <- getwd() -setwd("~/Projects/rrricanes") - -# GitHub -repo <- repository("./datasets") - -## ---- Functions -------------------------------------------------------------- -parse_products <- function(x, y) { - - # Load last published dates - pub_dates <- read_csv("./datasets/pub_dates.csv", col_types = cols()) - - # Get title of product - title <- xml_find_all(y, "title") %>% xml_text() - - # Get pubdate of products - pd <- xml_find_all(y, "pubDate") %>% xml_text() %>% - strptime(format = "%a, %d %b %Y %T", tz = "UTC") - - # Set product and column types of existing dataset. Remember Adv is char. - if (str_detect(title, "Public Advisory")) { - product = "public" - col_types = "cccTc" - } else if (str_detect(title, "Forecast Advisory")) { - product = "fstadv" - col_types = paste0("cccTcddiiniiiiiiiiiiiiiiii", - # 12 hrs - "Tddiiiiiiiiiiiiii", - # 24 hrs - "Tddiiiiiiiiiiiiii", - # 36 hrs - "Tddiiiiiiiiiiiiii", - # 48 hrs - "Tddiiiiiiiiiiiiii", - # 72 hrs - "Tddiiiiiiiiiiiiii", - # Seas - "iiii", - # 96 hrs - "Tddiiiiiiiiiiiiii", - #120 hrs - "Tddiiiiiiiiiiiiii") - } else if (str_detect(title, "Forecast Discussion")) { - product = "discus" - col_types = "cccTc" - } else if (str_detect(title, "Wind Speed Probabilities")) { - product = "wndprb" - col_types = "ccTciiiiiiiiiiiiii" - } else if (str_detect(title, "Tropical Cyclone Update")) { - product = "update" - col_types = "cccTc" - } - - last_update <- pub_dates %>% - filter(Product == product) %>% - .[[x]] %>% - as.POSIXct() - - if (pd <= last_update) return(NULL) - - # At this point we have a new product. Get URL to product and scrape - link <- xml_find_all(y, "link") %>% xml_text() - - func <- getAnywhere(product)$objs[[1]] - - func_call <- safely(func) - - ret <- func_call(link) - - if (!is.null(ret$error)) { - warning(sprintf("%s\n%s", ret$error, link)) - return(NULL) - } - - if (is.null(ret$result)) { - # wndprb product may not contain any probabilities making the dataframe - # empty. Return NULL in this instance. - - # Update pub_dates dataframe and save - pub_dates[pub_dates$Product == product,][x] <- as.POSIXct(pd) - write_csv(pub_dates, path = "./datasets/pub_dates.csv") - - add(repo, "./datasets/pub_dates.csv") - commit(repo, sprintf("pub_dates updated as of %s", pd)) - return(NULL) - } - - # Import and update latest product datafile - df <- read_csv(sprintf("./datasets/%s.csv", product), col_types = col_types) - - updated_df <- bind_rows(df, ret$result) - write_csv(updated_df, path = sprintf("./datasets/%s.csv", product)) - - if (product == "fstadv") { - ## ---- Tidy fstadv ---------------------------------------------------- - adv <- tidy_fstadv(updated_df) - write_csv(adv, path = "./datasets/adv.csv") - - fcst <- tidy_fcst(updated_df) - write_csv(fcst, path = "./datasets/fcst.csv") - - fcst_wr <- tidy_fcst_wr(updated_df) - write_csv(fcst_wr, path = "./datasets/fcst_wr.csv") - - wr <- tidy_wr(updated_df) - write_csv(wr, path = "./datasets/wr.csv") - } - - # Update pub_dates dataframe and save - pub_dates[pub_dates$Product == product,][x] <- as.POSIXct(pd) - write_csv(pub_dates, path = "./datasets/pub_dates.csv") - - ## ---- Stage Changes ------------------------------------------------------ - status <- status(repo) - status$unstaged - if (!is_empty(status$unstaged)) { - add(repo, status$unstaged %>% flatten() %>% sprintf("./datasets/%s", .)) - commit(repo, sprintf("%s updated as of %s", product, pd)) - push(repo) - } -} - -## ---- Scrape Index ----------------------------------------------------------- -# Index URLs to scrape for active cyclones -index_urls <- c("http://www.nhc.noaa.gov/index-at.xml", - "http://www.nhc.noaa.gov/index-ep.xml") - -# Load XML as list -indices <- index_urls %>% map(read_xml) - -# Go through each index output and check for active cyclones. If no storms are -# active then do nothing. - -# AL example (active cyclone): -# http://www.nhc.noaa.gov/rss_examples/index-at-20130605.xml -# EP example (active cyclone): -# http://www.nhc.noaa.gov/rss_examples/index-ep.xml - -# Based on the examples provided and current indexes (with no active cyclones -# in either basin), there is a nhc:wallet element as a child of nhc::Cyclone. -# The nhc:wallet element contains a string (e.g., AT1) which indicates the basin -# (Atlantic) and wallet number (1). This should tell us there is an active -# cyclone. -wallets <- indices %>% - map(xml_find_all, xpath = ".//nhc:wallet") %>% - map(xml_text) %>% - flatten_chr() - -if (is_empty(wallets)) - stop("No active cyclones.") - -## ---- Scrape Products -------------------------------------------------------- -# At this point we have a vector of wallets that need to be parsed. Inside each -# wallet is an overall pubDate for each product. This pubDate needs to be -# checked against the value in pub_dates.csv to ensure that we do not write -# existing data. -urls <- map_chr(wallets, str_to_lower) %>% - sprintf("http://www.nhc.noaa.gov/nhc_%s.xml", .) - -# Extract all items -items <- map(urls, read_xml) %>% map(xml_find_all, xpath = ".//item") - -# Match the products we need -item_matches <- map(items, str_detect, - pattern = paste0("(Public Advisory|Forecast Advisory|", - "Forecast Discussion|", - "Wind Speed Probabilities|", - "Tropical Cyclone Update) ", - "Number")) - -# Keep only those matches -items <- map2(items, item_matches, keep) - -# Begin parsing products -walk2(wallets, items, walk2, parse_products) - -## ---- Reset Options ---------------------------------------------------------- -options("rrricanes.working_msg" = opts.working_msg) -# Reset working directory -setwd(wd) - -## ---- Send Email ------------------------------------------------------------- -from <- "" -to <- "" -subject <- "rrricanes fetch products" -body <- read_file("fetch_products.Rout") -mailControl = list(smtpServer = "ASPMX.L.GOOGLE.COM") -sendmail(from = from, to = to, subject = subject, msg = body, - control = mailControl) diff --git a/data-raw/update_datasets.R b/data-raw/update_datasets.R deleted file mode 100644 index d3d3b8ee..00000000 --- a/data-raw/update_datasets.R +++ /dev/null @@ -1,92 +0,0 @@ -#'----------------------------------------------------------------------------'# -#' '# -#' Update datasets '# -#' '# -#'----------------------------------------------------------------------------'# -#' -#' Update datasets with missing advisories. Currently expects that given a key -#' looks for products with datetimes after the highest datetime value in the -#' dataset. If an advisory is missing but later advisories issued are present, -#' this script will not work. -#' -#' It can handle multiple keys. -#' -#' Consider it a brute-force script. -#' -#' Execution: -#' Rscript ~/Projects/rrricanes/data-raw/update_datasets.R &>> ~/Projects/rrricanes/data-raw/log.txt - -cat("\n\n###############################################################\n\n\n") -Sys.time() - -## ---- Libraries -------------------------------------------------------------- -library(dplyr) -library(purrr) -library(readr) -library(rrricanes) -library(stringr) - -## ---- Options ---------------------------------------------------------------- -options(scipen = 999) -opts.working_msg <- getOption("rrricanes.working_msg") -options("rrricanes.working_msg" = TRUE) - -# Change working directory -wd <- getwd() -setwd("~/Projects/rrricanes") - -products <- c("discus", "fstadv", "posest", "public", "prblty", "update", - "wndprb") - -keys <- commandArgs(trailingOnly = TRUE) - -if (purrr::is_empty(keys)) - stop("No storm keys provided.") - -walk(keys, .f = function(key) { - walk(products, .f = function(product) { - - # Extract command line arguments - basin <- str_sub(key, 0L, 2L) - year_num <- str_sub(key, 3L, 4L) %>% as.numeric() - year <- str_sub(key, 5L, 8L) %>% as.numeric() - - # Get storm - storm_link <- get_storms(year = year, basin = basin) %>% - slice(year_num) %>% - .$Link - - # Get product for current cyclone - func <- get_storm_data - func_call <- safely(func) - ret <- func_call(storm_link, products = product) - - if (!is.null(ret$error)) { - warning(sprintf("%s\n%s", ret$error, link)) - return(NULL) - } - - # If no results, exit - if (purrr::is_empty(ret$result[[product]])) - return(NULL) - - # Read in full dataset - full_df <- read_csv(sprintf("./datasets/%s.csv", product)) - - max_date <- full_df %>% dplyr::filter(Key == key) %>% .$Date %>% max() - - filtered_df <- ret$result[[product]] %>% dplyr::filter(Date > max_date) - - df <- bind_rows(full_df, filtered_df) - - write_csv(df, sprintf("./datasets/%s.csv", product)) - - }) - -}) - -## ---- Reset Options ---------------------------------------------------------- -options(scipen = 0) -options("rrricanes.working_msg" = opts.working_msg) -# Reset working directory -setwd(wd) diff --git a/data-raw/update_storms.R b/data-raw/update_storms.R deleted file mode 100644 index b37071c0..00000000 --- a/data-raw/update_storms.R +++ /dev/null @@ -1,14 +0,0 @@ -library(dplyr) -library(readr) -library(rrricanes) - -fstadv <- load_storm_data("fstadv") - -storms <- fstadv %>% - group_by(Key) %>% - summarise(Name = last(Name), - Wind = max(Wind), - StartDate = first(Date), - EndDate = last(Date)) - -write_csv(storms, "./datasets/storms.csv") diff --git a/deploy.sh b/deploy.sh deleted file mode 100644 index 9ce32369..00000000 --- a/deploy.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -set -o errexit -o nounset -addToDrat(){ - PKG_REPO=$PWD - - cd ..; mkdir drat; cd drat - - ## Set up Repo parameters - git init - git config user.name "Tim Trice" - git config user.email "tim.trice@gmail.com" - git config --global push.default simple - - ## Get drat repo - git remote add upstream "https://$GH_TOKEN@github.com/timtrice/drat.git" - git fetch upstream 2>err.txt - git checkout gh-pages - - Rscript -e "drat::insertPackage('$PKG_REPO/$PKG_TARBALL', \ - repodir = '.', \ - commit='Travis update: build $TRAVIS_BUILD_NUMBER')" - git push 2> /tmp/err.txt - -} -addToDrat diff --git a/docker/devel/Dockerfile b/docker/devel/Dockerfile index e3c90c16..252658b7 100644 --- a/docker/devel/Dockerfile +++ b/docker/devel/Dockerfile @@ -42,7 +42,11 @@ RUN install2.r -e \ remotes \ xml2 -RUN Rscript -e 'install.packages("rrricanesdata", repos = "https://timtrice.github.io/drat/", type = "source");' +RUN Rscript -e 'remotes::install_github("ropensci/rrricanesdata");' + +RUN Rscript -e 'remotes::install_github("ropensci/rnaturalearthhires");' + +RUN Rscript -e 'remotes::install_github("ropenscilabs/travis");' RUN cd /home/rstudio/.rstudio/monitored/user-settings/ \ && mv user-settings user-settings.copy \ diff --git a/docker/oldrelease/Dockerfile b/docker/oldrelease/Dockerfile index 845ce1dc..0e1384f5 100644 --- a/docker/oldrelease/Dockerfile +++ b/docker/oldrelease/Dockerfile @@ -42,7 +42,9 @@ RUN install2.r -e \ remotes \ xml2 -RUN Rscript -e 'install.packages("rrricanesdata", repos = "https://timtrice.github.io/drat/", type = "source");' +RUN Rscript -e 'remotes::install_github("ropensci/rrricanesdata");' + +RUN Rscript -e 'remotes::install_github("ropensci/rnaturalearthhires");' RUN cd /home/rstudio/.rstudio/monitored/user-settings/ \ && mv user-settings user-settings.copy \ diff --git a/docker/release/Dockerfile b/docker/release/Dockerfile index 0695814c..26189634 100644 --- a/docker/release/Dockerfile +++ b/docker/release/Dockerfile @@ -42,7 +42,11 @@ RUN install2.r -e \ remotes \ xml2 -RUN Rscript -e 'install.packages("rrricanesdata", repos = "https://timtrice.github.io/drat/", type = "source");' +RUN Rscript -e 'remotes::install_github("ropensci/rrricanesdata");' + +RUN Rscript -e 'remotes::install_github("ropensci/rnaturalearthhires");' + +RUN Rscript -e 'remotes::install_github("ropenscilabs/travis");' RUN cd /home/rstudio/.rstudio/monitored/user-settings/ \ && mv user-settings user-settings.copy \ diff --git a/docs/CHANGELOG.html b/docs/CHANGELOG.html deleted file mode 100644 index 33ffba41..00000000 --- a/docs/CHANGELOG.html +++ /dev/null @@ -1,759 +0,0 @@ - - - - - - - - -Change Log • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

All notable changes to this project will be documented in this file.

-

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

-
-

-[Unreleased] yyyy-mm-dd

-
-

-Added

-
    -
  • -nm_to_sm Convert nautical miles to survey miles. (#99)
  • -
  • -tidy_adv to replace tidy_fstadv which will be removed in release 0.2.2 (#103)
  • -
  • -get_storm_list returns dataframe of all known cyclones. (#114)
  • -
-
-
-

-Changed

-
    -
  • gis_download and gis_latest can accept parameters for rgdal::readOGR (#104).

  • -
  • ep_prblty_stations now returns all stations.

  • -
  • al_prblty_stations, cp_prblty_stations and ep_prblty_stations datasets were modified with additional columns. Changes are documented.

  • -
-
-
-

-Removed

-
    -
  • NA
  • -
-
-
-

-Deprecated

-
    -
  • NA
  • -
-
-
-

-Fixed

-
    -
  • -tidy_fcst now returns all forecast periods; previously only returned hours 12:96 (#107)
  • -
  • NHC GIS page went from using POST to GET parameters at some point recently for wind speed probability datasets. Func gis_wsp modified accordingly. (#108)
  • -
-
-
-

-Security

-
    -
  • NA
  • -
-
-
-
-

-[0.2.0-6] 2017-07-16

-
-

-Added

-
    -
  • NA
  • -
-
-
-

-Changed

-
    -
  • -get_storms and get_storm_data now use asynchronous http requests to make data collection faster. (#94)
  • -
  • Prefaced all built-in data objects with “df”; modified names slightly.
  • -
-
-
-

-Removed

-
    -
  • -load_storm_data has been removed. Archived data can now be accessed through rrricanesdata.
  • -
-
-
-

-Deprecated

-
    -
  • NA
  • -
-
-
-

-Fixed

-
    -
  • NA
  • -
-
-
-

-Security

-
    -
  • NA
  • -
-
-
-
-

-[0.2.0-5.1] 2017-07-10

-
-

-Added

-
    -
  • Instructions for Linux users to install libgdal1-dev, libproj-dev, and libxml2-dev. (#95)
  • -
-
-
-

-Added

-
    -
  • NA
  • -
-
-
-

-Changed

-
    -
  • NA
  • -
-
-
-

-Removed

-
    -
  • NA
  • -
-
-
-

-Deprecated

-
    -
  • NA
  • -
-
-
-

-Fixed

-
    -
  • NA
  • -
-
-
-

-Security

-
    -
  • NA
  • -
-
-
-
-

-[0.2.0-5] 2017-07-08

-
-

-Added

-
    -
  • NA
  • -
-
-
-

-Changed

- -
-
-

-Removed

-
    -
  • NA
  • -
-
-
-

-Deprecated

-
    -
  • NA
  • -
-
-
-

-Fixed

-
    -
  • NA
  • -
-
-
-

-Security

-
    -
  • NA
  • -
-
-
-
-

-[0.2.0-4] 2017-06-25

-
-

-Added

-
    -
  • NA
  • -
-
-
-

-Changed

-
    -
  • Added variable Key to discus dataframes. (#80)
  • -
  • Removed variable Adv from posest. Position estimates do not have advisory numbers. (#81)
  • -
  • Fix scrape_adv_num to accomodate possible “INTERMEDIATE” text in Public Advisory headers. (#83)
  • -
  • Remove variable Adv from update. Updates do not have advisory numbers. (#84)
  • -
  • Added variable Key to get_public dataframes. (#85)
  • -
  • Added variable Key to get_update dataframes. (#86)
  • -
  • Removed non-existent wind radii variables in get_fstadv. Hrs 48 and 72 hours only have 34 and 50kt wind fields. Hrs 96 and 120 have none. (#89)
  • -
-
-
-

-Removed

-
    -
  • NA
  • -
-
-
-

-Deprecated

-
    -
  • NA
  • -
-
-
-

-Fixed

-
    -
  • NA
  • -
-
-
-

-Security

-
    -
  • NA
  • -
-
-
-
-

-[0.2.0-3] 2017-06-22

-
-

-Added

-
    -
  • Examples for functions knots_to_mph, mb_to_in, status_abbr_to_str, get_discus, get_fstadv, tidy_fstadv, tidy_wr, tidy_fcst and tidy_fcst_wr.
  • -
-
-
-

-Changed

-
    -
  • Added data files to make building vignettes quicker.
  • -
  • Added skip_on_cran to tests. Additionally, slimmed down some tests. Previous tests exist in branch tests and will be redeveloped.
  • -
  • Minor documentation updates and corrections.
  • -
-
-
-

-Removed

-
    -
  • NA
  • -
-
-
-

-Deprecated

-
    -
  • NA
  • -
-
-
-

-Fixed

-
    -
  • NA
  • -
-
-
-

-Security

-
    -
  • NA
  • -
-
-
-
-

-[0.2.0-2] 2017-06-22

-
-

-Added

-
    -
  • NA
  • -
-
-
-

-Changed

-
    -
  • NA
  • -
-
-
-

-Removed

-
    -
  • NA
  • -
-
-
-

-Deprecated

-
    -
  • NA
  • -
-
-
-

-Fixed

-
    -
  • Advisories now issued when tropical cyclone development is anticipated, but not yet occurred, and watches and warnings need to be issued. See AL022017, AL032017.
  • -
  • Added additional time zones (HDT, HST, MDT, MST)
  • -
  • Appended additional headers (TCE, WTPA, MIATCM, MIAWRKAD1, MIAWRKAP)
  • -
-
-
-

-Security

-
    -
  • NA
  • -
-
-
-
-

-[0.2.0-1] 2017-06-16

-
-

-Added

-
    -
  • GIS functions gis_advisory, gis_breakpoints, gis_latest, gis_outlook, gis_prob_storm_surge, gis_windfield and gis_wsp added. These functions return one or more URLs to datasets that can be downloaded with gis_download.
  • -
  • -shp_to_df added to convert lines and polygons spatial dataframes to dataframes. Points dataframes can be converted using tibble::as_dataframe (target the @data object).
  • -
-
-
-

-Changed

-
    -
  • -load_storm_data now returns full datasets from the rrricanesdata repo including tidied fstadv data. See documentation for notes on other products. (#76)
  • -
-
-
-

-Removed

-
    -
  • NA
  • -
-
-
-

-Deprecated

-
    -
  • Not yet deprecated but a warning that al_prblty_stations, cp_prblty_stations and ep_prblty_stations may be removed on a future release. (#46)
  • -
-
-
-

-Fixed

-
    -
  • dplyr 0.6.0 has renamed the .cols parameter of mutate_at to .vars. Have modified pkg to accept both dplyr 0.5.0 and >= 0.6.0. This will be removed in future releases. (#74)
  • -
-
-
-

-Security

-
    -
  • NA
  • -
-
-
-
-

-[0.1.3] 2017-06-11

-
-

-Added

-
    -
  • -rrricanes.http_sleep to control time to sleep between multiple HTTP requests.
  • -
-
-
-

-Changed

-
    -
  • Update documentation for get_fstadv, get_prblty, get_wndprb, tidy_fstadv, tidy_wr, tidy_fcst and tidy_fcst_wr.
  • -
-
-
-

-Removed

-
    -
  • NA
  • -
-
-
-

-Deprecated

-
    -
  • NA
  • -
-
-
-

-Fixed

-
    -
  • Correct tidy_fcst and tidy_fcst_wr when all forecast periods do not exist. Previously, was expected that all forecast fields would exist. This may not always be the case. Now works only available forecast periods. (#73)
  • -
-
-
-

-Security

-
    -
  • NA
  • -
-
-
-
-

-[0.1.2] - 2017-06-08

-
-

-Added

-
    -
  • dplyr.progress_bar for all products
  • -
  • rrricanes.working_msg option to show current working advisory.
  • -
  • -tracking_chart() for a base world plot. al_tracking_chart() for chart centered on Atlantic basin. ep_tracking_chart() for chart centered on northeast Pacific.
  • -
  • -load_storm_data() helps get datasets that have already been scraped and processed. Designed to make it more efficient to get data faster.
  • -
  • -status_abbr_to_str converts storm status abbreviations (i.e., TD, TS, HU) to string.
  • -
  • -saffir returns Saffir-Simpson classification of tropical cyclones; abbreviated.
  • -
  • -twoal and twoep for Atlantic and east Pacific tropical weather outlooks.
  • -
  • Added options rrricanes.http_timeout and rrricanes.http_attempts to give user more control over failures.
  • -
-
-
-

-Changed

-
    -
  • -get_storm_data now takes link as first parameter for chaining. Returns a list of dataframes for each product.
  • -
  • -tidy_fstadv, tidy_wr, tidy_fcst and tidy_fcst_wr have been added to replaced now-removed fstadv_split().
  • -
  • Completed package top-level documentation.
  • -
-
-
-

-Removed

-
    -
  • -fstadv_split. Dataframe can be split if desired by user.
  • -
-
-
-

-Deprecated

-
    -
  • NA
  • -
-
-
-

-Fixed

-
    -
  • Fix call to get_storms on some Linux distros which generated xpath_element fun error. (#67)
  • -
  • Fix call to get_storm_data. Issue similar to #67. (#68)
  • -
  • Fix call to gis_wsp. Call in rvest::html_nodes generated “xpath_attrib” error. Add test for gis_wsp. (#70)
  • -
-
-
-

-Security

-
    -
  • NA
  • -
-
-
-
-

-[0.1.0] - 2017-05-12

-
-

-Added

-
    -
  • -al_prblty_stations Get list of locations for wind speed probabilities in Atlantic basin.
  • -
  • -cp_prblty_stations Get list of locations for wind speed probabilities in central Pacific basin.
  • -
  • -fstadv_split split dataframe returned from fstadv() to four narrow dataframes.
  • -
  • -get_discus get storm discussions from a storm’s archive page.
  • -
  • -get_fstadv get forecast/advisory products from a storm’s archive page.
  • -
  • -get_nhc_link returns link to NHC homepage
  • -
  • -get_posest get position estimates from a storm’s archive page.
  • -
  • -get_prblty get strike probabilities from a storm’s archive page.
  • -
  • -get_products get links to all products for a storm.
  • -
  • -get_public get public advisory statements from a storm’s archive page.
  • -
  • -get_storms get a list for storms from a year’s archive page.
  • -
  • -get_storm_data get one or multiple products for a storm
  • -
  • -get_update get updates from a storm’s archive page.
  • -
  • -get_wndprb get wind speed probabilities from a storm’s archive page.
  • -
  • -knots_to_mph Convert values from knots to mph (for wind and gust values).
  • -
  • -mb_to_in convert barometric pressure from millibars to inches.
  • -
  • -wndprb Access a specific wind speed probability for a storm.
  • -
-
-
-

-Changed

-
    -
  • Correct version, CHANGELOG and NEWS from previous “release”.
  • -
-
-
-

-Removed

-
    -
  • NA
  • -
-
-
-

-Deprecated

-
    -
  • NA
  • -
-
-
-

-Fixed

-
    -
  • NA
  • -
-
-
-

-Security

-
    -
  • NA
  • -
-
-
-
- -
- -
- - -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - diff --git a/docs/CONTRIBUTING.html b/docs/CONTRIBUTING.html deleted file mode 100644 index 762754a2..00000000 --- a/docs/CONTRIBUTING.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - -Contributing • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
- -

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

-

Please note we have a code of conduct, please follow it in all your interactions with the project.

-
-

-Pull Request Process

-
    -
  1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
  2. -
  3. Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
  4. -
  5. Increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent. The versioning scheme we use is SemVer.
  6. -
  7. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.
  8. -
-
-
-

-Code of Conduct

-
-

-Our Pledge

-

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

-
-
-

-Our Standards

-

Examples of behavior that contributes to creating a positive environment include:

-
    -
  • Using welcoming and inclusive language
  • -
  • Being respectful of differing viewpoints and experiences
  • -
  • Gracefully accepting constructive criticism
  • -
  • Focusing on what is best for the community
  • -
  • Showing empathy towards other community members
  • -
-

Examples of unacceptable behavior by participants include:

-
    -
  • The use of sexualized language or imagery and unwelcome sexual attention or advances
  • -
  • Trolling, insulting/derogatory comments, and personal or political attacks
  • -
  • Public or private harassment
  • -
  • Publishing others’ private information, such as a physical or electronic address, without explicit permission
  • -
  • Other conduct which could reasonably be considered inappropriate in a professional setting
  • -
-
-
-

-Our Responsibilities

-

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

-

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

-
-
-

-Scope

-

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

-
-
-

-Enforcement

-

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at . All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

-

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.

-
-
-

-Attribution

-

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at http://contributor-covenant.org/version/1/4

-
-
-
- -
- -
- - -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - diff --git a/docs/ISSUE_TEMPLATE.html b/docs/ISSUE_TEMPLATE.html deleted file mode 100644 index cbaaa22d..00000000 --- a/docs/ISSUE_TEMPLATE.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - -NA • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -
-

-Error Message

-
-
-

-Reproducible Example

-
-
-

-Traceback

-
-
-

-Session Info

-
- - -
- -
- - -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html deleted file mode 100644 index 192d3535..00000000 --- a/docs/LICENSE-text.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - -License • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
YEAR: 2017
-COPYRIGHT HOLDER: Tim Trice
-
-The MIT License (MIT)
-
-Copyright (c) 2017 Tim Trice
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-  
-  The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
- -
- -
- - -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - diff --git a/docs/PULL_REQUEST_TEMPLATE.html b/docs/PULL_REQUEST_TEMPLATE.html deleted file mode 100644 index f4c78a36..00000000 --- a/docs/PULL_REQUEST_TEMPLATE.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - - • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - - -
-

-Overview

-

What problem or feature request does this pull request resolve?

-
-
-

-Issues Addressed

-
    -
  • -
-
-
-

-Changes Addressed/Proposed

-
    -
  • -
-
-
-

-Reproducible Examples

-

Demonstrate how the new code performs.

-
-
-

-Notes

-

Optional. Ancillary topics, caveats, alternative strategies that didn’t work out, anything else.

-
-
-

-Tests

-

Include test cases, and expected output

-
- - -
- -
- - -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - diff --git a/docs/articles/accumulated_cyclone_energy.html b/docs/articles/accumulated_cyclone_energy.html deleted file mode 100644 index 85c64731..00000000 --- a/docs/articles/accumulated_cyclone_energy.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - - -Accumulated Cyclone Energy (ACE) • rrricanes - - - - - - - - - - -
-
- - - -
-
- - - - -
library(dplyr)
-library(ggplot2)
-library(HURDAT)
-library(lubridate)
-library(readr)
-library(rrricanes)
-library(rrricanesdata)
-

ACE or Accumulated Cyclone Energy is a method of measuring energy of a cyclone or for an entire season. It is calculated by the formula

-

\[ \text{ACE} = 10^{-4}\sum{v^2_\text{max}} \]

-

where \(v_\text{max}\) is the wind speed in knots. Values may only be used when a storm is a tropical system with winds of at least 35 knots. Additionally, only six-hour intervals are used.

-

To calculate ACE you would want to use the fstadv dataset and apply the following rules:

-
    -
  • since forecast/advisory products are typically issued at 03:00, 09:00, 15:00 and 21:00 UTC filter out odd hours
  • -
  • -Status is Tropical Storm or Hurricane.
  • -
  • -Wind is not NA
  • -
  • group by Key -
  • -
  • select Wind -
  • -
-
fstadv <- fstadv %>% 
-    filter(hour(Date) %in% c(3, 9, 15, 21), 
-           Status %in% c("Tropical Storm", "Hurricane"), 
-           !is.na(Wind)) %>% 
-    group_by(Key) %>% 
-    select(Name, Wind)
-
## Adding missing grouping variables: `Key`
-

Now let’s summarise our dataset with new variable ACE.

-
fstadv %>% 
-    summarise(Name = last(Name), 
-              ACE = sum(Wind^2) * 1e-04) %>% 
-    arrange(desc(ACE)) %>% 
-    top_n(10)
-
## Selecting by ACE
-
## # A tibble: 10 x 3
-##    Key      Name      ACE
-##    <chr>    <chr>   <dbl>
-##  1 AL092004 Ivan     69.9
-##  2 AL112017 Irma     66.6
-##  3 AL132003 Isabel   62.5
-##  4 AL142016 Matthew  48.0
-##  5 AL062004 Frances  46.9
-##  6 AL152017 Maria    44.6
-##  7 AL091999 Gert     44.0
-##  8 AL112010 Igor     42.9
-##  9 AL102003 Fabian   42.6
-## 10 EP071999 Dora     42.2
-

This matches somewhat well with Wikipedia and other sources. But, you may notice we’re missing some storms. rrricanes currently only holds data back to 1998; this data is considered “real-time”.

-

A companion package, HURDAT is available in CRAN that has data for all cyclones dating back as far as 1851. This package has less data than rrricanes. But, as it is based on a post-storm reanalysis project, the data is more accurate.

-

Let’s revisit the top 10 using HURDAT:

-
AL %>% 
-    filter(hour(DateTime) %in% c(0, 6, 12, 18), 
-           Status %in% c("TS", "HU"), 
-           !is.na(Wind)) %>% 
-    group_by(Key) %>% 
-    summarise(Name = last(Name), 
-              ACE = sum(Wind^2) * 1e-04) %>% 
-    arrange(desc(ACE)) %>% 
-    top_n(10)
-
## Selecting by ACE
-
## # A tibble: 10 x 3
-##    Key      Name      ACE
-##    <chr>    <chr>   <dbl>
-##  1 AL031899 UNNAMED  73.6
-##  2 AL092004 IVAN     71.5
-##  3 AL112017 IRMA     64.9
-##  4 AL091893 UNNAMED  63.5
-##  5 AL132003 ISABEL   63.3
-##  6 AL041926 UNNAMED  60.9
-##  7 AL141932 UNNAMED  59.8
-##  8 AL041906 UNNAMED  56.0
-##  9 AL041957 CARRIE   55.8
-## 10 AL091966 INEZ     54.6
-

A couple of things to notice here:

-
    -
  1. in HURDAT, the common times used are 00:00, 06:00, 12:00 and 18:00 UTC
  2. -
  3. Our list is more comprehensive than the Wikipedia list as that list only measures storms after 1950.
  4. -
-

ACE is slightly higher and that could be for a number of reasons. For example, on re-analysis the Hurricane Research Division may have determined a cyclone was actually tropical (shown in HURDAT) when initially it was believed to be extratropical (as shown in rrricanes). Or, and more likely, they determined through additional data that a storm was actually stronger than originally though.

-

You can also calculate ACE for a season. Instead of grouping by Key we group by Year. I’ll stick with HURDAT in this example.

-
(df <- AL %>% 
-    mutate(Year = year(DateTime)) %>% 
-    filter(hour(DateTime) %in% c(0, 6, 12, 18), 
-           Status %in% c("TS", "HU"), 
-           !is.na(Wind)) %>% 
-    group_by(Year) %>% 
-    summarise(ACE = sum(Wind^2) * 1e-04) %>% 
-    arrange(desc(ACE))) %>% 
-    top_n(10)
-
## Selecting by ACE
-
## # A tibble: 10 x 2
-##     Year   ACE
-##    <dbl> <dbl>
-##  1  1933  259.
-##  2  2005  246.
-##  3  1893  231.
-##  4  1926  230.
-##  5  1995  228.
-##  6  2004  226.
-##  7  2017  225.
-##  8  1950  211.
-##  9  1961  205.
-## 10  1998  182.
-

This also matches relatively well with that on Wikipedia and other sources.

-
ggplot(df, aes(x = Year, y = ACE)) + 
-    geom_bar(stat = "identity") + 
-    theme_bw()
-

-

It would certainly seem that tropical cyclone activity ebbs and flows over time.

-
- - - -
- - -
- -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - diff --git a/docs/articles/accumulated_cyclone_energy_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/accumulated_cyclone_energy_files/figure-html/unnamed-chunk-6-1.png deleted file mode 100644 index 43ec2d33..00000000 Binary files a/docs/articles/accumulated_cyclone_energy_files/figure-html/unnamed-chunk-6-1.png and /dev/null differ diff --git a/docs/articles/forecast_advisory.html b/docs/articles/forecast_advisory.html deleted file mode 100644 index f9488c2d..00000000 --- a/docs/articles/forecast_advisory.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - - -Forecast/Advisory GIS • rrricanes - - - - - - - - - - -
-
- - - -
-
- - - - -
library(dplyr)
-library(ggplot2)
-library(rrricanes)
-library(rrricanesdata)
-library(sp)
- -
fstadv <- fstadv %>% filter(Key == key, Adv <= adv)
-
-

-GIS Advisory Forecast Track, Cone of Uncertainty, and Watches/Warnings

-
gis_adv <- gis_advisory(key = key, advisory = adv) %>% gis_download()
-
## OGR data source with driver: ESRI Shapefile 
-## Source: "/tmp/Rtmpo0A76k", layer: "al092008.042_5day_lin"
-## with 2 features
-## It has 9 fields
-## OGR data source with driver: ESRI Shapefile 
-## Source: "/tmp/Rtmpo0A76k", layer: "al092008.042_5day_pgn"
-## with 2 features
-## It has 9 fields
-## OGR data source with driver: ESRI Shapefile 
-## Source: "/tmp/Rtmpo0A76k", layer: "al092008.042_5day_pts"
-## with 13 features
-## It has 20 fields
-## OGR data source with driver: ESRI Shapefile 
-## Source: "/tmp/Rtmpo0A76k", layer: "al092008.042_ww_wwlin"
-## with 5 features
-## It has 10 fields
-

Get bounding box of the forecast polygon.

-
bbox <- bbox(gis_adv$al092008.042_5day_pgn)
-

Generate a base plot of the Atlantic ocean.

-
(bp <- al_tracking_chart(color = "black", fill = "white", size = 0.1, res = 50))
-
## Regions defined for each Polygons
-## Regions defined for each Polygons
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
-

-

I like to add a little cushion for the map inset and forecast cone data.

- -

Build a thin tracking map for the inset.

- -

Modify original bp zoomed in on our area of interest.

-
(bp <- bp +
-     coord_equal(xlim = c(lon_min, lon_max),
-                 ylim = c(lat_min, lat_max)) +
-     scale_x_continuous(expand = c(0, 0)) +
-     scale_y_continuous(expand = c(0, 0)) +
-     labs(x = "Lon",
-          y = "Lat",
-          caption = sprintf("rrricanes %s", packageVersion("rrricanes"))))
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
-

-

Combine bp and bp_inset to finalize initial base plot. bp will be a base plot without the inset. bpi will have the inset.

- -

-
-
-

-Current Advisory Details

-

Lines and Polygons spatial dataframes can be helpfully converted using shp_to_df. The original spatial dataframes can be plotted directly in ggplot2 but, to my understanding, access to the other variables are not available.

- -
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
-
## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
shp_storm_ww <- shp_to_df(gis_adv$al092008.042_ww_wwlin)
-
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
- -
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-

Points dataframes can just be converted with tibble::as_data_frame.

- -
## Warning: `as_data_frame()` is deprecated, use `as_tibble()` (but mind the new semantics).
-## This warning is displayed once per session.
-

Modify shp_storm_pts$DVLBL with full strings and ordered factor.

-
shp_storm_pts$DVLBL <- factor(shp_storm_pts$DVLBL, 
-                              levels = c("D", "S", "H"), 
-                              labels = c("Tropical Depression", 
-                                         "Tropical Storm", 
-                                         "Hurricane"))
-

Same with shp_storm_pts$TCWW:

-
shp_storm_ww$TCWW <- factor(shp_storm_ww$TCWW, 
-                            levels = c("TWA", "TWR", "HWA", "HWR"), 
-                            labels = c("Tropical Storm Watch", 
-                                       "Tropical Storm Warning", 
-                                       "Hurricane Watch", 
-                                       "Hurricane Warning"))
-
bpi + geom_polygon(data = shp_storm_pgn, 
-                   aes(x = long, y = lat, group = group),
-                   alpha = 0.15, fill = "orange") + 
-    geom_path(data = shp_storm_lin, aes(x = long, y = lat, group = group)) + 
-    geom_point(data = shp_storm_pts, aes(x = LON, y = LAT, fill = DVLBL,
-                                         shape = DVLBL, size = MAXWIND)) + 
-    geom_path(data = shp_storm_ww, aes(x = long, y = lat, color = TCWW, 
-                                       group = group), size = 1) + 
-    scale_shape_manual(values = c(21, 21, 21, 21)) + 
-    guides(shape = guide_legend(override.aes = list(size = 3)), 
-           size = guide_legend(nrow = 1)) + 
-    theme(legend.position = "bottom", 
-          legend.box = "vertical")
-

-

Very often, areas that are under a hurricane watch may also be under a tropical storm warning. The chart above does not show the hurricane watch area.

-
-
- - - -
- - -
- -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - diff --git a/docs/articles/forecast_advisory_files/figure-html/unnamed-chunk-10-1.png b/docs/articles/forecast_advisory_files/figure-html/unnamed-chunk-10-1.png deleted file mode 100644 index df82d0cc..00000000 Binary files a/docs/articles/forecast_advisory_files/figure-html/unnamed-chunk-10-1.png and /dev/null differ diff --git a/docs/articles/forecast_advisory_files/figure-html/unnamed-chunk-15-1.png b/docs/articles/forecast_advisory_files/figure-html/unnamed-chunk-15-1.png deleted file mode 100644 index 5611420d..00000000 Binary files a/docs/articles/forecast_advisory_files/figure-html/unnamed-chunk-15-1.png and /dev/null differ diff --git a/docs/articles/forecast_advisory_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/forecast_advisory_files/figure-html/unnamed-chunk-6-1.png deleted file mode 100644 index 7c6217cd..00000000 Binary files a/docs/articles/forecast_advisory_files/figure-html/unnamed-chunk-6-1.png and /dev/null differ diff --git a/docs/articles/forecast_advisory_files/figure-html/unnamed-chunk-9-1.png b/docs/articles/forecast_advisory_files/figure-html/unnamed-chunk-9-1.png deleted file mode 100644 index 04674db6..00000000 Binary files a/docs/articles/forecast_advisory_files/figure-html/unnamed-chunk-9-1.png and /dev/null differ diff --git a/docs/articles/getting_started.html b/docs/articles/getting_started.html deleted file mode 100644 index 281fe3a2..00000000 --- a/docs/articles/getting_started.html +++ /dev/null @@ -1,423 +0,0 @@ - - - - - - - -Getting Started • rrricanes - - - - - - - - - - -
-
- - - -
-
- - - - -
library(dplyr)
-library(rrricanes)
-
-

-General Introduction

-

rrricanes is intended to give easy access to hurricane archives. It is a web-scraping tool that parses the National Hurricane Center’s (NHC) archives to get storm data. Data is available for storms dating back to 1998.

-

There are two basins which data is available: north Atlantic (“AL”) and northeastern Pacific (“EP”). The northeastern Pacific basin typically covers from the west coast of North America to -140° longitude (140°W).

-
-
-

-Get Storms

-

By default, get_storms will return all storms that have developed for the current year in both basins. If no storms have developed, an error will be generated. For this example, we’ll use 2012.

-
df.al_2012 <- get_storms(years = 2012, basins = "AL")
-
-
-

-Getting Storm Data

-

get_storm_data can be used to retrieve one or multiple products for one or more cyclones. A list of dataframes is returned.

-
df.al_18_2012_fstadv <- df.al_2012 %>% 
-    filter(Name == "Hurricane Sandy") %>% 
-    .$Link %>% 
-    get_storm_data(products = "fstadv")
-

We can get the forecast/advisory data and wind speed probabilities at once:

-
df.al_18_2012 <- df.al_2012 %>% 
-    filter(Name == "Hurricane Sandy") %>% 
-    .$Link %>% 
-    get_storm_data(c("fstadv", "wndprb"))
-

df.al_18_2012 now contains two dataframes for Hurricane Sandy; fstadv and wndprb.

-
-
-

-Forecast/Advisory Product (fstadv)

-

The core of a storm’s dataset is located in the Forecast/Advisory product, fstadv. This product contains current location, forecast position, movement and structural details of the cyclone.

-

To access only this product, we can use get_fstadv:

- -

As you may have noticed above, the dataframe is very wide at 149 variables. There are four groups of variables in this dataset: current details, current wind radii, forecast positions, and forecast wind radii.

-
-

-Current Details

-

Let’s look at an example of the current details.

-
str(df.al_18_2012_fstadv %>% select(Status:Eye, SeasNE:SeasNW))
-
## Classes 'tbl_df', 'tbl' and 'data.frame':    31 obs. of  18 variables:
-##  $ Status  : chr  "Tropical Depression" "Tropical Storm" "Tropical Storm" "Tropical Storm" ...
-##  $ Name    : chr  "Eighteen" "Sandy" "Sandy" "Sandy" ...
-##  $ Adv     : num  1 2 3 4 5 6 7 8 9 10 ...
-##  $ Date    : POSIXct, format: "2012-10-22 15:00:00" "2012-10-22 21:00:00" ...
-##  $ Key     : chr  "AL182012" "AL182012" "AL182012" "AL182012" ...
-##  $ Lat     : num  13.5 12.5 12.7 13.3 13.8 14.3 15.2 16.3 17.1 18.3 ...
-##  $ Lon     : num  -78 -78.5 -78.6 -78.6 -77.8 -77.6 -77.2 -77 -76.7 -76.6 ...
-##  $ Wind    : num  25 35 40 40 45 45 50 60 70 70 ...
-##  $ Gust    : num  35 45 50 50 55 55 60 75 85 85 ...
-##  $ Pressure: num  1003 999 998 998 993 ...
-##  $ PosAcc  : num  45 50 25 40 30 30 20 20 20 20 ...
-##  $ FwdDir  : num  230 NA NA 360 20 20 15 10 15 10 ...
-##  $ FwdSpeed: num  4 NA NA 3 4 5 9 12 11 12 ...
-##  $ Eye     : num  NA NA NA NA NA NA 25 NA NA NA ...
-##  $ SeasNE  : num  NA 60 60 70 75 90 180 180 180 180 ...
-##  $ SeasSE  : num  NA 60 45 80 60 90 180 180 240 240 ...
-##  $ SeasSW  : num  NA 0 0 0 0 0 0 45 0 0 ...
-##  $ SeasNW  : num  NA 0 45 50 50 50 0 100 90 90 ...
-

The most important variable in this dataset is Key. Key is a unique identifier for each storm that develops in either basin. It is formatted such as “AABBCCCC” where “AA” is the basin abbreviation (AL or EP), “BB” is the year number of the storm left-padded, and “CC” is the year of the storm.

-

Adv is the second-most important variable here. You’ll notice it is in character format. For regularly-scheduled advisories, advisory numbers are always numeric. However, when watches and warnings are in effect, intermediate advisories are issued which are given alpha suffixes; i.e., 1, 2, 3, 3A, 4, 4A, 4B, 5, etc.

-

Only the Public Advisory (public) will be issued more frequently. All other regular products (discus, fstadv, prblty, wndprb) are generally issued every six hours.

-

Status lists the current designation of the cyclone, i.e., Tropical Depression, Tropical Storm, etc. A Name is given once a storm crosses the threshold of Tropical Storm; that is, winds greater than 33kts.

-

Lat and Lon are the current position of the storm within PosAcc nautical miles. All distance measurements are in nautical miles.

-

Wind and Gust are current one-minute sustained wind speeds in knots (kts). You can use the function knots_to_mph to convert this. All wind speed values are in knots.

-

Pressure is the lowest atmospheric pressure of the cyclone either measured or estimated. It’s value is in millibars but you can use mb_to_in() to convert to inches.

-

FwdDir and FwdSpeed show the compass direction of the forward movement of the cyclone. NA values indicate the storm is stationary or drifting. FwdSpeed is measured in knots.

-

In some cases, where hurricanes have an identifiable Eye, it’s diameter in nautical miles will also be listed.

-

Lastly, the Seas variables will exist for a storm of at least tropical storm-strength. This is the distance from the center of circulation that 12ft seas can be found in each quadrant. The measurement is in nautical miles.

-

Helper function tidy_fstadv will subset this data to a narrow dataframe.

-
tidy_fstadv(df.al_18_2012_fstadv)
-
## Warning: `tidy_fstadv is deprecated and will be removed in v0.2.2
-
## # A tibble: 31 x 18
-##    Key     Adv Date                Status Name    Lat   Lon  Wind  Gust
-##    <chr> <dbl> <dttm>              <chr>  <chr> <dbl> <dbl> <dbl> <dbl>
-##  1 AL18…     1 2012-10-22 15:00:00 Tropi… Eigh…  13.5 -78      25    35
-##  2 AL18…     2 2012-10-22 21:00:00 Tropi… Sandy  12.5 -78.5    35    45
-##  3 AL18…     3 2012-10-23 03:00:00 Tropi… Sandy  12.7 -78.6    40    50
-##  4 AL18…     4 2012-10-23 09:00:00 Tropi… Sandy  13.3 -78.6    40    50
-##  5 AL18…     5 2012-10-23 15:00:00 Tropi… Sandy  13.8 -77.8    45    55
-##  6 AL18…     6 2012-10-23 21:00:00 Tropi… Sandy  14.3 -77.6    45    55
-##  7 AL18…     7 2012-10-24 03:00:00 Tropi… Sandy  15.2 -77.2    50    60
-##  8 AL18…     8 2012-10-24 09:00:00 Tropi… Sandy  16.3 -77      60    75
-##  9 AL18…     9 2012-10-24 15:00:00 Hurri… Sandy  17.1 -76.7    70    85
-## 10 AL18…    10 2012-10-24 21:00:00 Hurri… Sandy  18.3 -76.6    70    85
-## # … with 21 more rows, and 9 more variables: Pressure <dbl>, PosAcc <dbl>,
-## #   FwdDir <dbl>, FwdSpeed <dbl>, Eye <dbl>, SeasNE <dbl>, SeasSE <dbl>,
-## #   SeasSW <dbl>, SeasNW <dbl>
-
-
-

-Wind Radius

-

Any cyclone of at least tropical storm-strength will have associated wind radius values. This is the distance from the center of circulation that a specified wind speed (34kts, 50kts, 64kts) can be found in each quadrant. Measurement is in nautical miles.

-
str(df.al_18_2012_fstadv %>% select(NE64:NW34))
-
## Classes 'tbl_df', 'tbl' and 'data.frame':    31 obs. of  12 variables:
-##  $ NE64: num  NA NA NA NA NA NA NA NA 20 25 ...
-##  $ SE64: num  NA NA NA NA NA NA NA NA 20 20 ...
-##  $ SW64: num  NA NA NA NA NA NA NA NA 0 0 ...
-##  $ NW64: num  NA NA NA NA NA NA NA NA 0 0 ...
-##  $ NE50: num  NA NA NA NA NA NA 0 50 50 50 ...
-##  $ SE50: num  NA NA NA NA NA NA 80 70 60 60 ...
-##  $ SW50: num  NA NA NA NA NA NA 0 0 30 40 ...
-##  $ NW50: num  NA NA NA NA NA NA 0 0 30 40 ...
-##  $ NE34: num  NA 50 50 70 70 80 90 100 110 110 ...
-##  $ SE34: num  NA 60 60 80 80 90 120 120 120 120 ...
-##  $ SW34: num  NA 0 0 0 0 0 0 45 60 70 ...
-##  $ NW34: num  NA 0 0 0 0 0 30 45 60 60 ...
-

A helper function, tidy_wr will reorganize this data into a narrow format and tidied up. Complete wind radius values that are NA are removed for efficiency.

-
tidy_wr(df.al_18_2012_fstadv)
-
## # A tibble: 77 x 8
-##    Key        Adv Date                WindField    NE    SE    SW    NW
-##    <chr>    <dbl> <dttm>                  <dbl> <dbl> <dbl> <dbl> <dbl>
-##  1 AL182012     2 2012-10-22 21:00:00        34    50    60     0     0
-##  2 AL182012     3 2012-10-23 03:00:00        34    50    60     0     0
-##  3 AL182012     4 2012-10-23 09:00:00        34    70    80     0     0
-##  4 AL182012     5 2012-10-23 15:00:00        34    70    80     0     0
-##  5 AL182012     6 2012-10-23 21:00:00        34    80    90     0     0
-##  6 AL182012     7 2012-10-24 03:00:00        34    90   120     0    30
-##  7 AL182012     7 2012-10-24 03:00:00        50     0    80     0     0
-##  8 AL182012     8 2012-10-24 09:00:00        34   100   120    45    45
-##  9 AL182012     8 2012-10-24 09:00:00        50    50    70     0     0
-## 10 AL182012     9 2012-10-24 15:00:00        34   110   120    60    60
-## # … with 67 more rows
-
-
-

-Forecast

-

Most Forecast/Advisory products will have forecast data associated with it unless the storm has dissipated or is no longer tropical. There may be up to seven forecast positions. These positions are issued by 12-hour intervals through 48 hours where they are then at 24-hour intervals; 12, 24, 36, 48, 72, 96 and 120 hours.

-
str(df.al_18_2012_fstadv %>% select(Hr12FcstDate:Hr12Gust))
-

Notice each variable begins with the prefix “Hrn” where n is the forecast period as noted above. Only Date, Lat, Lon, Wind, Gust and wind radius (will discuss shortly) are given for forecast periods.

-

Use tidy_fcst to tidy forecast data.

-
tidy_fcst(df.al_18_2012_fstadv)
-
## # A tibble: 216 x 8
-##    Key     Adv Date                FcstDate              Lat   Lon  Wind
-##    <chr> <dbl> <dttm>              <dttm>              <dbl> <dbl> <dbl>
-##  1 AL18…     1 2012-10-22 15:00:00 2012-10-23 00:00:00  13.7 -78.3    35
-##  2 AL18…     1 2012-10-22 15:00:00 2012-10-23 12:00:00  14.3 -78.1    45
-##  3 AL18…     1 2012-10-22 15:00:00 2012-10-24 00:00:00  15.7 -77.6    55
-##  4 AL18…     1 2012-10-22 15:00:00 2012-10-24 12:00:00  17.4 -77      60
-##  5 AL18…     1 2012-10-22 15:00:00 2012-10-25 12:00:00  20.5 -76      55
-##  6 AL18…     1 2012-10-22 15:00:00 2012-10-26 12:00:00  24.5 -74.5    55
-##  7 AL18…     1 2012-10-22 15:00:00 2012-10-27 12:00:00  27   -73      50
-##  8 AL18…     2 2012-10-22 21:00:00 2012-10-23 06:00:00  13.6 -78.5    35
-##  9 AL18…     2 2012-10-22 21:00:00 2012-10-23 18:00:00  14.9 -78.3    45
-## 10 AL18…     2 2012-10-22 21:00:00 2012-10-24 06:00:00  16.4 -77.8    55
-## # … with 206 more rows, and 1 more variable: Gust <dbl>
-
-

-Forecast Dates/Times

-

A note about forecast times.

-
df.al_18_2012_fstadv %>% select(Date, Hr12FcstDate) %>% slice(1)
-
## # A tibble: 1 x 2
-##   Date                Hr12FcstDate       
-##   <dttm>              <dttm>             
-## 1 2012-10-22 15:00:00 2012-10-23 00:00:00
-

Notice the Date of this advisory is Oct 22 at 15:00 UTC. The Hr12FcstDate is Oct 23, 00:00 UTC. This difference, obviously, is not 12 hours. What gives? Forecast/Advisory products are issued with two “current” positions: one that is current (and provided in the dataset) and a position from three hours prior. So, in this specific advisory the text would contain the position of the storm for Oct 22, 12:00 UTC. It is from this position the forecast points are based. I do not know why.

-

Therefore, while officially the forecast periods are 12, 24, 36, … hours, in reality they are 9, 21, 33, … hours from the issuance time of the product.

-
-
-
-

-Forecast Wind Radius

-

Some forecast positions may also contain wind radius information (only up to 72 hours).

-
str(df.al_18_2012_fstadv %>% select(Hr12NE64:Hr12NW34))
-

Again, these variables are prepended with the prefix prefix “Hrn” where n notes the forecast period.

-

tidy_fcst_wr will tidy this subset of data.

-
tidy_fcst_wr(df.al_18_2012_fstadv)
-
## # A tibble: 337 x 9
-##    Key     Adv Date                FcstDate            WindField    NE
-##    <chr> <dbl> <dttm>              <dttm>                  <dbl> <dbl>
-##  1 AL18…     1 2012-10-22 15:00:00 2012-10-23 00:00:00        34    40
-##  2 AL18…     1 2012-10-22 15:00:00 2012-10-23 12:00:00        34    50
-##  3 AL18…     1 2012-10-22 15:00:00 2012-10-24 00:00:00        34    80
-##  4 AL18…     1 2012-10-22 15:00:00 2012-10-24 00:00:00        50    30
-##  5 AL18…     1 2012-10-22 15:00:00 2012-10-24 12:00:00        34    90
-##  6 AL18…     1 2012-10-22 15:00:00 2012-10-24 12:00:00        50    40
-##  7 AL18…     1 2012-10-22 15:00:00 2012-10-25 12:00:00        34   200
-##  8 AL18…     1 2012-10-22 15:00:00 2012-10-25 12:00:00        50    50
-##  9 AL18…     2 2012-10-22 21:00:00 2012-10-23 06:00:00        34    50
-## 10 AL18…     2 2012-10-22 21:00:00 2012-10-23 18:00:00        34    50
-## # … with 327 more rows, and 3 more variables: SE <dbl>, SW <dbl>, NW <dbl>
-

Please see the National Hurricane Center’s website for more information on understanding the Forecast/Advisory product.

-
-
-
-

-Strike Probabilities (prblty)

-

Strike probabilities were discontinued after the 2005 hurricane season (replaced by Wind Speed Probabilities; wndprb). For this example, we’ll look at Hurricane Katrina. For this we use the function get_prblty.

-
df.al_12_2005_prblty <- get_storms(year = 2005, basin = "AL") %>% 
-    filter(Name == "Hurricane Katrina") %>% 
-    .$Link %>% 
-    get_prblty()
-
str(df.al_12_2005_prblty)
-
## Classes 'tbl_df', 'tbl' and 'data.frame':    937 obs. of  10 variables:
-##  $ Status  : chr  "Tropical Depression" "Tropical Depression" "Tropical Depression" "Tropical Depression" ...
-##  $ Name    : chr  "Twelve" "Twelve" "Twelve" "Twelve" ...
-##  $ Adv     : chr  "1" "1" "1" "1" ...
-##  $ Date    : POSIXct, format: "2005-08-23 21:00:00" "2005-08-23 21:00:00" ...
-##  $ Location: chr  "25.0N  77.7W" "JACKSONVILLE FL" "25.7N  78.5W" "SAVANNAH GA" ...
-##  $ A       : num  50 0 36 0 19 0 0 0 0 0 ...
-##  $ B       : num  0 0 0 0 6 0 1 0 0 5 ...
-##  $ C       : num  0 2 0 0 1 0 0 0 0 3 ...
-##  $ D       : num  0 9 1 6 1 3 3 2 2 5 ...
-##  $ E       : num  50 11 37 6 27 3 4 2 2 13 ...
-

This dataframe contains the possibility of a cyclone passing within 65 nautical miles of Location. The variables A, B, C, D, and E are as they appear in the products and were left as-is to avoid confusion. They’re definition is as follows:

-
    -
  • -A - current through 12 hours.
  • -
  • -B - within the next 12-24 hours
  • -
  • -C - within the next 24-36 hours
  • -
  • -D - within the next 36-48 hours
  • -
  • -E - Total probability from current through 48 hours.
  • -
-

Many values in the text product may be “X” for less than 1% chance of a strike. These values are converted to 0 as the fields are numeric.

-

The strike probability products did not contain Key which is the unique identifier for every cyclone. So the best way to do any joins will be by Name, Adv and Date.

-

Strike Probabilities may not exist for most Pacific cyclones.

-
-
-

-Wind Speed Probabilities (wndprb)

- -
str(df.al_18_2012_wndprb)
-
## Classes 'tbl_df', 'tbl' and 'data.frame':    2227 obs. of  18 variables:
-##  $ Key       : chr  "AL182012" "AL182012" "AL182012" "AL182012" ...
-##  $ Adv       : num  1 1 1 1 1 1 1 1 1 1 ...
-##  $ Date      : POSIXct, format: "2012-10-22 15:00:00" "2012-10-22 15:00:00" ...
-##  $ Location  : chr  "FT PIERCE FL" "W PALM BEACH" "MIAMI FL" "MARATHON FL" ...
-##  $ Wind      : num  34 34 34 34 34 34 34 50 64 34 ...
-##  $ Wind12    : num  0 0 0 0 0 0 0 0 0 0 ...
-##  $ Wind24    : num  0 0 0 0 1 0 0 0 0 0 ...
-##  $ Wind24Cum : num  0 0 0 0 1 0 0 0 0 0 ...
-##  $ Wind36    : num  0 0 0 0 1 0 0 0 0 0 ...
-##  $ Wind36Cum : num  0 0 0 0 2 0 0 0 0 0 ...
-##  $ Wind48    : num  0 0 0 0 1 0 0 0 0 0 ...
-##  $ Wind48Cum : num  0 0 0 0 3 0 0 0 0 0 ...
-##  $ Wind72    : num  0 0 0 0 0 0 3 0 0 5 ...
-##  $ Wind72Cum : num  0 0 0 0 3 0 3 0 0 5 ...
-##  $ Wind96    : num  1 2 3 2 0 5 10 3 1 12 ...
-##  $ Wind96Cum : num  1 2 3 2 3 5 13 3 1 17 ...
-##  $ Wind120   : num  2 2 1 1 0 3 5 2 0 3 ...
-##  $ Wind120Cum: num  3 4 4 3 3 8 18 5 1 20 ...
-

Wind Speed Probabilities are a bit more advanced than their predecessor. The Wind variable is for 34kt, 50kt and 64kt winds expected within a specific time period.

-

Each consecutive variable is within a specific time-frame (12, 24, 36, 48, 72, 96 and 120 hours) for both that time frame and cumulative.

-

For example, Wind24 is the chance of Wind between 12-24 hours. Wind24Cum is the cumulative probability from Date through 24 hours.

-

As with strike probabilities, an “X” in the original text product meant less than 0.5% chance for the specified wind in the specified time period. “X” has been replaced by 0 in this package.

-

Wind Speed Probabilities may not exist for most Pacific cyclones.

-

See Tropical Cyclone Wind Speed Probabilities Products for more information.

-
-
-

-Other products

-

Other products are available:

-
    -
  • get_public for Public Advisory statements. Think general information for the public audience. May not exist for some Pacific cyclones. Additionally, when watches and warnings are issued, these are issued every 3 hours (and, in some cases, every two).

  • -
  • get_discus for Storm Discussions. These are more technical statements on the structure of a storm, forecast model tendencies and satellite presentation.

  • -
  • get_update These are brief update statements when something considerable has changed in the cyclone or if the cyclone is making landfall.

  • -
  • get_posest. Position estimates are generally issued when a storm is making landfall and may be issued hourly.

  • -
-

Hurricane Ike, 2008, has both updates and position estimates.

-

At this time none of these products are parsed. Only the content of the product is returned.

-
-
- - - -
- - -
- -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - diff --git a/docs/articles/gis_data.html b/docs/articles/gis_data.html deleted file mode 100644 index 195da278..00000000 --- a/docs/articles/gis_data.html +++ /dev/null @@ -1,1093 +0,0 @@ - - - - - - - -GIS data • rrricanes - - - - - - - - - - -
-
- - - -
-
- - - - -
library(dplyr)
-library(ggplot2)
-library(rrricanes)
-library(sf)
-

Most storms will contain a variation of GIS datasets that can be plotted with ggplot2. The helper functions for this have the prefix ‘gis’.

-

All products are experimental and there maybe fluctuations particularly in current datasets.

-

In general, datasets are available for storms dated back to 1998. However, products such as Wind Speed Probabilities only go back to 1999.

-

Some datasets require the use of the storm key and an optional advisory. Other products require a datetime value and cannot be isolated by storm key or advisory. The datetime values are not based on the issue time of the advisory, but rather three hours prior. For example, if you are seeking a dataset where the forecast/advisory was issued at 9:00AM UTC, you will want the dataset for 6:00AM UTC. This will be explained a little further below.

-
-

-Build a Tracking Chart

-

There are three functions available to help you plot GIS data; tracking_chart, al_tracking_chart and ep_tracking_chart. al_tracking_chart and ep_tracking_chart are just helpers centered on the Atlantic and northeast Pacific ocean, respectively.

-
args(rrricanes::tracking_chart)
-
## function (countries = TRUE, states = TRUE, res = 110, ...) 
-## NULL
-

The countries and states parameters are TRUE by default. This means a basic call to tracking_chart will return a map with country and state borders. The res parameter is resolution; one of 110, 50 or 10 nautical miles. Resolutions 110nm and 50nm can be used immediately. To use lower resolution you must install the rnaturalearthdatahires package from ropensci:

- -

tracking_chart will print a basic tracking chart (a map of the planet).

- -
## Regions defined for each Polygons
-## Regions defined for each Polygons
-

-

You can pass typical aes parameters to refine the color and fill of the plot; remember the tracking chart is a ggplot object.

-
tracking_chart(color = "black", fill = "white", size = 0.1)
-
## Regions defined for each Polygons
-## Regions defined for each Polygons
-

-

You may choose to only show coastline data instead. In this case, just set the countries parameter to FALSE.

-
tracking_chart(countries = FALSE, res = 50, color = "black", fill = "white", 
-               size = 0.1)
-

-

For the purposes of this vignette we’ll focus on Atlantic storms.

-
(p <- al_tracking_chart(color = "black", fill = "white", size = 0.1, res = 50))
-
## Regions defined for each Polygons
-## Regions defined for each Polygons
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
-

-

The res parameter defines the resolution of the chart presented. Options are in 110nm, 50nm and 10nm. The lower the resolution the longer the chart takes to be built.

-

States cannot be drawn on resolution greater than 50nm.

-
-
-

-GIS Datasets

-

There are several datasets that are published for active cyclones. The following functions are designed to return the URL to those datasets:

-
    -
  • gis_advisory
  • -
  • gis_prob_storm_surge
  • -
  • gis_windfield
  • -
  • gis_latest
  • -
-
-
-

-Advisory Package

-
gis_advisory(key = "AL182012", advisory = "18")
-
## [1] "https://www.nhc.noaa.gov/gis/forecast/archive/al182012_5day_018.zip"
-
df.gis_adv <- gis_advisory(key = "AL182012", advisory = "18") %>% gis_download()
-
names(df.gis_adv)
-
## [1] "al182012.018_5day_lin" "al182012.018_5day_pgn" "al182012.018_5day_pts"
-## [4] "al182012.018_ww_wwlin"
-

For this particular storm and advisory, included are the base line, point and polygon datasets along with a dataset for watches and warnings. The objects returned are spatial dataframes contained within the list of dataframes, df.gis_adv.

-
-

-Line track

-
str(df.gis_adv$al182012.018_5day_lin)
-
## Formal class 'SpatialLinesDataFrame' [package "sp"] with 4 slots
-##   ..@ data       :'data.frame':  2 obs. of  7 variables:
-##   .. ..$ STORMNAME: chr [1:2] "SANDY" "SANDY"
-##   .. ..$ STORMTYPE: chr [1:2] "HU" "HU"
-##   .. ..$ ADVDATE  : chr [1:2] "121026/2100" "121026/2100"
-##   .. ..$ ADVISNUM : chr [1:2] "18" "18"
-##   .. ..$ STORMNUM : num [1:2] 18 18
-##   .. ..$ FCSTPRD  : num [1:2] 72 120
-##   .. ..$ BASIN    : chr [1:2] "al" "al"
-##   ..@ lines      :List of 2
-##   .. ..$ :Formal class 'Lines' [package "sp"] with 2 slots
-##   .. .. .. ..@ Lines:List of 1
-##   .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot
-##   .. .. .. .. .. .. ..@ coords: num [1:6, 1:2] -77.1 -77 -76.1 -74.3 -72.6 ...
-##   .. .. .. ..@ ID   : chr "0"
-##   .. ..$ :Formal class 'Lines' [package "sp"] with 2 slots
-##   .. .. .. ..@ Lines:List of 1
-##   .. .. .. .. ..$ :Formal class 'Line' [package "sp"] with 1 slot
-##   .. .. .. .. .. .. ..@ coords: num [1:8, 1:2] -77.1 -77 -76.1 -74.3 -72.6 ...
-##   .. .. .. ..@ ID   : chr "1"
-##   ..@ bbox       : num [1:2, 1:2] -77.1 27.3 -71.5 41
-##   .. ..- attr(*, "dimnames")=List of 2
-##   .. .. ..$ : chr [1:2] "x" "y"
-##   .. .. ..$ : chr [1:2] "min" "max"
-##   ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
-##   .. .. ..@ projargs: chr "+proj=longlat +a=6371200 +b=6371200 +no_defs"
-

As we’re dealing with a SpatialLinesDataFrame which needs to be modified, you can use the helper function shp_to_df for plotting.

-
fcst_line <- shp_to_df(df.gis_adv$al182012.018_5day_lin)
-
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
-
## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
p + geom_path(data = fcst_line, aes(long, lat, group = FCSTPRD))
-

-

There are two groups of data in the set: one for 72-hour forecast period and one for 120-hour. Grouping by FCSTPRD will show the forecast track correctly.

-

There is a pretty wide field of view on the map above. You can use sp::bbox to “zoom in” on the map.

-
(bb <- sp::bbox(df.gis_adv$al182012.018_5day_lin))
-
##     min   max
-## x -77.1 -71.5
-## y  27.3  41.0
-
(p2 <- p + geom_path(data = fcst_line, aes(long, lat, group = FCSTPRD)) + 
-    coord_equal(xlim = c(bb[1,1] - 5, bb[1,2] + 5), 
-                ylim = c(bb[2,1] - 5, bb[2,2] + 5)))
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
-

-
-
-

-Point track

-

Each forecast position is also included in the points dataframe. You can access this in the df.gis_adv$al182012.018_5day_pts@data object; no conversion necessary.

-
(p3 <- p2 + geom_point(data = df.gis_adv$al182012.018_5day_pts@data, aes(LON, LAT)))
-

-
-
-
-

-Forecast Cone

-

Forecast cone data is contained in the polygon dataset. To deal with this dataset you can use the shp_to_df function again or take the slightly longer way:

- -
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
-
## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
fcst_cone <- dplyr::left_join(fcst_cone.points, fcst_cone@data, by = "id")
-
p3 + geom_polygon(data = fcst_cone %>% filter(FCSTPRD == 120), 
-                 aes(long, lat, group = group, fill = factor(FCSTPRD)), 
-                 alpha = 0.5) + 
-    geom_polygon(data = fcst_cone %>% filter(FCSTPRD == 72), 
-                 aes(long, lat, group = group, fill = factor(FCSTPRD)), 
-                 alpha = 0.5)
-

-

Note that in some GIS packages the forecast cones may be identical (though they shouldn’t be). I’ve noticed it with Hurricanes Ike and Matthew; it’s in the raw dataset.

-
-
-

-Watches and Warnings

-

You can also plot watches and warnings if any are in effect for the package release time.

-
ww_line <- shp_to_df(df.gis_adv$al182012.018_ww_wwlin)
-
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
-
## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
p3 + geom_path(data = ww_line, 
-               aes(x = long, y = lat, group = group, color = TCWW), size = 1)
-

-

In the example above you can see tropical storm warnings issued for the Bahamas, North Carolina and portions of the South Carolina and Florida coast while tropical storm watches are in effect for northern Florida and South Carolina.

-
-
-

-Probabilistic Storm Surge

-

The Tropical Cyclone Storm Surge Probabilities data shows the probability, in percent, of a specified storm surge occurring during the forecast period indicated. The product is based upon an ensemble of Sea, Lake, and Overland Surge from Hurricanes (SLOSH) model runs using the National Hurricane Center (NHC) official advisory and accounts for track, size, and intensity errors based on historical errors.

-
gis_prob_storm_surge(key = "AL142016", products = list(psurge = 0), 
-                     datetime = "20161006")
-
## [1] "https://www.nhc.noaa.gov/gis/storm_surge/al142016_psurge0_2016100600.zip"
-## [2] "https://www.nhc.noaa.gov/gis/storm_surge/al142016_psurge0_2016100606.zip"
-## [3] "https://www.nhc.noaa.gov/gis/storm_surge/al142016_psurge0_2016100612.zip"
-## [4] "https://www.nhc.noaa.gov/gis/storm_surge/al142016_psurge0_2016100618.zip"
- -
prob_surge <- shp_to_df(df.gis_storm_surge$al142016_2016100618_gt0)
-
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
-
## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
-
## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
bb <- sp::bbox(df.gis_storm_surge$al142016_2016100618_gt0)
-
p + geom_path(data = prob_surge, 
-               aes(x = long, y = lat, group = group, color = PSurge00c), 
-              size = 1, alpha = 0.5) + 
-    coord_equal(xlim = c(bb[1,1], bb[1,2]), ylim = c(bb[2,1], bb[2,2]))
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
-

-
-
-

-Current and Forecast Wind Field Radii

-

Wind radii data may also be available for some cyclone advisory packages. This is the radius to which a minimum sustained wind speed may be felt from the center of circulation.

-
gis_windfield("AL142016", advisory = "33")
-
## [1] "https://www.nhc.noaa.gov/gis/forecast/archive/al142016_fcst_033.zip"
-
df.gis_wind_radii <- gis_windfield("AL142016", advisory = "33") %>% gis_download()
-
wf_init <- shp_to_df(df.gis_wind_radii$al142016_2016100606_initialradii)
-
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
-
## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
bb <- sp::bbox(df.gis_wind_radii$al142016_2016100606_forecastradii)
-
(p4 <- p + geom_polygon(data = wf_init, 
-                  aes(x = long, y = lat, fill = factor(RADII)), alpha = 0.5) + 
-    coord_equal(xlim = c(bb[1,1], bb[1,2]), ylim = c(bb[2,1], bb[2,2])))
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
-

-

Additionally, forecast wind radii data is also generally available in some packages

-
wf_fcst <- shp_to_df(df.gis_wind_radii$al142016_2016100606_forecastradii)
-
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
-
## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
p4 + geom_polygon(data = wf_fcst, 
-                  aes(x = long, y = lat, group = group, fill = factor(RADII)), 
-                  alpha = 0.5)
-

-
-
-

-Wind Speed Probabilities

-

Wind Speed probabilities show the chance of experiencing a minimum-sustained winds of 34, 50 and 64 knots with a given period of time (typically, 120 hours). These products are not storm-specific but are global so other active cyclones in other basins may also appear.

-
gis_wsp(datetime = "2016100606", res = 0.5)
-
## [1] "https://www.nhc.noaa.gov/gis/forecast/archive/2016100606_wsp_120hrhalfDeg.zip"
- -
-

-Cumulative Probability for >34kt Winds

-
bb <- sp::bbox(df.gis_wsp$`2016100606_wsp34knt120hr_halfDeg`)
-p + 
-  geom_sf(
-    data = st_as_sf(df.gis_wsp$`2016100606_wsp34knt120hr_halfDeg`), 
-    aes(color = PWIND120)
-  ) +
-  coord_sf(xlim = c(bb[1,1], bb[1,2]), ylim = c(bb[2,1], bb[2,2]))
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
-

-

Cumulative wind speed probability for >50kt winds:

-
bb <- sp::bbox(df.gis_wsp$`2016100606_wsp50knt120hr_halfDeg`)
-p + 
-  geom_sf(
-    data = st_as_sf(df.gis_wsp$`2016100606_wsp50knt120hr_halfDeg`), 
-    aes(color = PWIND120)
-  ) +
-  coord_sf(xlim = c(bb[1,1], bb[1,2]), ylim = c(bb[2,1], bb[2,2]))
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
-

-

Cumulative probability for >64kt winds:

-
bb <- sp::bbox(df.gis_wsp$`2016100606_wsp64knt120hr_halfDeg`)
-p + 
-  geom_sf(
-    data = st_as_sf(df.gis_wsp$`2016100606_wsp64knt120hr_halfDeg`), 
-    aes(color = PWIND120)
-  ) +
-  coord_sf(xlim = c(bb[1,1], bb[1,2]), ylim = c(bb[2,1], bb[2,2]))
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
-

-
-
-
- - - -
- - -
- -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-13-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-13-1.png deleted file mode 100644 index 51ecd0c9..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-13-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-15-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-15-1.png deleted file mode 100644 index 9733f4ff..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-15-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-16-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-16-1.png deleted file mode 100644 index 9c40b2bc..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-16-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-18-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-18-1.png deleted file mode 100644 index b0b636a7..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-18-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-20-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-20-1.png deleted file mode 100644 index 49fa293e..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-20-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-24-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-24-1.png deleted file mode 100644 index 2c03ab76..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-24-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-28-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-28-1.png deleted file mode 100644 index de2ba277..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-28-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-30-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-30-1.png deleted file mode 100644 index 84f8e74f..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-30-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-33-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-33-1.png deleted file mode 100644 index 8375e7d6..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-33-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-34-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-34-1.png deleted file mode 100644 index 7556bea3..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-34-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-35-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-35-1.png deleted file mode 100644 index a8cf3f33..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-35-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-4-1.png deleted file mode 100644 index d83627bf..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-4-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-5-1.png deleted file mode 100644 index 95da19dd..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-5-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-6-1.png deleted file mode 100644 index 07655c3e..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-6-1.png and /dev/null differ diff --git a/docs/articles/gis_data_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/gis_data_files/figure-html/unnamed-chunk-7-1.png deleted file mode 100644 index 3fbdbf17..00000000 Binary files a/docs/articles/gis_data_files/figure-html/unnamed-chunk-7-1.png and /dev/null differ diff --git a/docs/articles/index.html b/docs/articles/index.html deleted file mode 100644 index 23fbe25e..00000000 --- a/docs/articles/index.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - -Articles • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - diff --git a/docs/articles/installing_rrricanesdata.html b/docs/articles/installing_rrricanesdata.html deleted file mode 100644 index 742e824d..00000000 --- a/docs/articles/installing_rrricanesdata.html +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - -Installing rrricanesdata • rrricanes - - - - - - - - - - -
-
- - - -
-
- - - - -

With rrricanes you can access current and archived advisories as-issued from the National Hurricane Center archives. rrricanesdata is a complimentary data package meant to make it faster to get most data avialable from these storms.

-

Installing rrricanesdata is simple:

- -

Data in rrricanesdata will be updated on the first of every month with a cutoff date of midnight on the last day of the month. So, advisories issued at any time during the current month will not be available; you will need to use any of rrricanes get_* functions.

-
-

-Datasets

-
-

-adv -

-
    -
  • Key: Unique identifier of cyclone
  • -
  • Adv: Advisory number
  • -
  • Date: Date and time of advisory
  • -
  • Status: Classification of cyclone
  • -
  • Name: Name of cyclone
  • -
  • Lat: Latitude of cyclone center
  • -
  • Lon: Longitude of cyclone center
  • -
  • Wind: Maximum sustained one-minute winds in knots
  • -
  • Gust: Maximum sustained one-minute gusts in knots
  • -
  • Pressure: Minimum central pressure in millibars
  • -
  • PosAcc: Position accuracy of cyclone in nautical miles
  • -
  • FwdDir: Compass angle of forward motion
  • -
  • FwdSpeed: Forward speed in miles per hour
  • -
  • Eye: Size of eye in nautical miles
  • -
  • SeasNE: Radius of 12ft seas in northeast quadrant
  • -
  • SeasSE: Radius of 12ft seas in southeast quadrant
  • -
  • SeasSW: Radius of 12ft seas in southwest quadrant
  • -
  • SeasNW: Radius of 12ft seas in northwest quadrant
  • -
-
-
-

-discus -

-
    -
  • Status: Classification of storm, e.g., Tropical Storm, Hurricane, etc.
  • -
  • Name: Name of storm
  • -
  • Adv: Advisory Number
  • -
  • Date: Date of advisory issuance
  • -
  • Key: ID of cyclone
  • -
  • Contents: Text content of product
  • -
-
-
-

-fcst -

-
    -
  • Key: Unique identifier of cyclone
  • -
  • Adv: Advisory number
  • -
  • Date: Date and time of advisory
  • -
  • FcstDate: Forecast date and time in UTC
  • -
  • Lat: Forecast latitude
  • -
  • Lon: Forecast Longitude
  • -
  • Wind: Forecast wind in knots
  • -
  • Gust: Forecast gust in knots
  • -
-
-
-

-fcst_wr -

-
    -
  • Key: Unique identifier of cyclone
  • -
  • Adv: Advisory number
  • -
  • Date: Date and time of advisory
  • -
  • FcstDate: Forecast date and time in UTC
  • -
  • WindField: Minimum sustained wind field for quadrants
  • -
  • NE: Radius in nautical miles for northeast quadrant
  • -
  • SE: Radius in nautical miles for southeast quadrant
  • -
  • SW: Radius in nautical miles for southwest quadrant
  • -
  • NW: Radius in nautical miles for northwest quadrant
  • -
-
-
-

-fstadv -

-
    -
  • Status: Classification of cyclone
  • -
  • Name: Name of cyclone
  • -
  • Adv: Advisory number
  • -
  • Date: Date and time of advisory
  • -
  • Key: Unique identifier of cyclone
  • -
  • Lat: Latitude of cyclone center
  • -
  • Lon: Longitude of cyclone center
  • -
  • Wind: Maximum sustained one-minute winds in knots
  • -
  • Gust: Maximum sustained one-minute gusts in knots
  • -
  • Pressure: Minimum central pressure in millibars
  • -
  • PosAcc: Position accuracy of cyclone in nautical miles
  • -
  • FwdDir: Compass angle of forward motion
  • -
  • FwdSpeed: Forward speed in miles per hour
  • -
  • Eye: Size of eye in nautical miles
  • -
  • NE64: Radius of >=64kt winds in northeast quadrant
  • -
  • SE64: Radius of >=64kt winds in southeast quadrant
  • -
  • SW64: Radius of >=64kt winds in southwest quadrant
  • -
  • NW64: Radius of >=64kt winds in northwest quadrant
  • -
  • NE50: Radius of >=50kt winds in northeast quadrant
  • -
  • SE50: Radius of >=50kt winds in southeast quadrant
  • -
  • SW50: Radius of >=50kt winds in southwest quadrant
  • -
  • NW50: Radius of >=50kt winds in northwest quadrant
  • -
  • NE34: Radius of >=34kt winds in northwest quadrant
  • -
  • SE34: Radius of >=34kt winds in southeast quadrant
  • -
  • SW34: Radius of >=34kt winds in southwest quadrant
  • -
  • NW34: Radius of >=34kt winds in northwest quadrant
  • -
  • Hr{n}FcstDate: Forecast valid date
  • -
  • Hr{n}Lat: Forecast latitude in n hours
  • -
  • Hr{n}Lon: Forecast longitude in n hours
  • -
  • Hr{n}Wind: Forecast maximum wind in n hours
  • -
  • Hr{n}Gust: Forecast maximum gust in n hours
  • -
  • Hr{n}NE64: Forecast wind radius in n hours
  • -
  • Hr{n}SE64: Forecast wind radius in n hours
  • -
  • Hr{n}SW64: Forecast wind radius in n hours
  • -
  • Hr{n}NW64: Forecast wind radius in n hours
  • -
  • Hr{n}NE50: Forecast wind radius in n hours
  • -
  • Hr{n}SE50: Forecast wind radius in n hours
  • -
  • Hr{n}SW50: Forecast wind radius in n hours
  • -
  • Hr{n}NW50: Forecast wind radius in n hours
  • -
  • Hr{n}NE34: Forecast wind radius in n hours
  • -
  • Hr{n}SE34: Forecast wind radius in n hours
  • -
  • Hr{n}SW34: Forecast wind radius in n hours
  • -
  • Hr{n}NW34: Forecast wind radius in n hours
  • -
  • SeasNE: Radius of 12ft seas in northeast quadrant
  • -
  • SeasSE: Radius of 12ft seas in southeast quadrant
  • -
  • SeasSW: Radius of 12ft seas in southwest quadrant
  • -
  • SeasNW: Radius of 12ft seas in northwest quadrant
  • -
-
-
-

-posest -

-
    -
  • Status: Classification of storm, e.g., Tropical Storm, Hurricane, etc.
  • -
  • Name: Name of storm
  • -
  • Date: Date of advisory issuance
  • -
  • Contents: Text content of product
  • -
-
-
-

-prblty -

-
    -
  • Status: Classification of storm, e.g., Tropical Storm, Hurricane, etc.
  • -
  • Name: Name of storm
  • -
  • Adv: Advisory Number
  • -
  • Date: Date of advisory issuance
  • -
  • Location: Location for which the probability statistics rely
  • -
  • A: Probability of a strike within the next 12 hours
  • -
  • B: Probability of a strike between 12 and 24 hours
  • -
  • C: Probability of a strike between 24 and 36 hours
  • -
  • D: Probability of a strike between 36 and 48 hours
  • -
  • E: Probability of a strike between 48 and 72 hours
  • -
-
-
-

-public -

-
    -
  • Status: Classification of storm, e.g., Tropical Storm, Hurricane, etc.
  • -
  • Name: Name of storm
  • -
  • Adv: Advisory Number
  • -
  • Date: Date of advisory issuance
  • -
  • Key: Unique ID of the cyclone
  • -
  • Contents: Text content of product
  • -
-
-
-

-storms -

-
    -
  • Key: Storm ID
  • -
  • Name: Storm name
  • -
  • Wind: Peak wind speed in knots
  • -
  • StartDate: Date/time of first advisory
  • -
  • EndDate: Date/time of last advisory
  • -
-
-
-

-update -

-
    -
  • Status: Classification of storm, e.g., Tropical Storm, Hurricane, etc.
  • -
  • Name: Name of storm
  • -
  • Date: Date of advisory issuance
  • -
  • Key: Unique ID of cyclone
  • -
  • Contents: Text content of product
  • -
-
-
-

-wndprb -

-
    -
  • Status: Classification of storm, e.g., Tropical Storm, Hurricane, etc.
  • -
  • Name: Name of storm
  • -
  • Adv: Advisory Number
  • -
  • Date: Date of advisory issuance
  • -
  • Wind: Minimum wind speed for which probabilities reference
  • -
  • Wind12: Probability of sustained Wind within 12 hours
  • -
  • Wind24: Probability of sustained Wind within 24 hours
  • -
  • Wind24Cum: Cumulative probability through 24 hours
  • -
  • Wind36: Probability of sustained Wind within 36 hours
  • -
  • Wind36Cum: Cumulative probability through 36 hours
  • -
  • Wind48: Probability of sustained Wind within 48 hours
  • -
  • Wind48Cum: Cumulative probability through 48 hours
  • -
  • Wind72: Probability of sustained Wind within 72 hours
  • -
  • Wind72Cum: Cumulative probability through 72 hours
  • -
  • Wind96: Probability of sustained Wind within 96 hours
  • -
  • Wind96Cum: Cumulative probability through 96 hours
  • -
  • Wind120: Probability of sustained Wind within 120 hours
  • -
  • Wind120Cum: Cumulative probability through 120 hours
  • -
-
-
-

-wr -

-
    -
  • Key: Unique identifier of cyclone
  • -
  • Adv: Advisory number
  • -
  • Date: Date and time of advisory
  • -
  • Windfield: Minimum wind speed expected
  • -
  • NE: Radius of Windfield in the northeast quadrant
  • -
  • SE: Radius of Windfield in the southeast quadrant
  • -
  • SW: Radius of Windfield in the southwest quadrant
  • -
  • NW: Radius of Windfield in the northwest quadrant
  • -
-
-
-
- - - -
- - -
- -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - diff --git a/docs/articles/probabilistic_storm_surge.html b/docs/articles/probabilistic_storm_surge.html deleted file mode 100644 index bcd01593..00000000 --- a/docs/articles/probabilistic_storm_surge.html +++ /dev/null @@ -1,721 +0,0 @@ - - - - - - - -Probabilistic Storm Surge • rrricanes - - - - - - - - - - -
-
- - - -
-
- - - - -
library(dplyr)
-library(ggplot2)
-library(rrricanes)
-library(rrricanesdata)
-library(sp)
-
-

-Data

- -
fstadv <- fstadv %>% filter(Key == key, Adv <= adv)
-
-
-

-Probabilistic Storm Surge

-

Calculate the last date/time of forecast/advisory product and subtract 3 hrs

-
dt <- (last(fstadv$Date) - (60 * 60 * 3)) %>% 
-    strftime(format = "%Y%m%d%H", tz = "UTC")
-

Wrap gis_download in safely. Not all products will exist for every storm or even every advisory.

-

I’m downloading the psurge products for 5 feet since there are no other storm surge products available for Ike.

-
dl <- purrr::safely(.f = gis_download)
-gis_surge <- gis_prob_storm_surge(key, products = list("psurge" = c(5)), 
-                                  datetime = dt) %>% dl()
-
## OGR data source with driver: ESRI Shapefile 
-## Source: "/tmp/RtmpYhM1pI", layer: "al092008_2008091112_gt5"
-## with 83 features
-## It has 2 fields
-
if (!is.null(gis_surge$error))
-    message(gis_surge$error)
-

Generate a base plot of the Atlantic ocean.

-
bp <- al_tracking_chart(color = "black", fill = "white", size = 0.1, res = 50)
-
## Regions defined for each Polygons
-## Regions defined for each Polygons
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
-

Since we’re dealing with a polygon shapefile, we can get the bounding box of the dataset.

-
bbox <- bbox(gis_surge$result$al092008_2008091112_gt5)
-

Add a little cushion for the map inset.

- -

Build a map inset.

- -

Modify original bp zoomed in on our area of interest.

-
bp <- bp +
-    coord_equal(xlim = c(lon_min, lon_max),
-                ylim = c(lat_min, lat_max)) +
-    scale_x_continuous(expand = c(0, 0)) +
-    scale_y_continuous(expand = c(0, 0)) +
-    labs(x = "Lon",
-         y = "Lat",
-         caption = sprintf("rrricanes %s", packageVersion("rrricanes")))
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
-

Combine bp and bp_inset to finalize initial base plot. bp will be a base plot without the inset. bpi will have the inset.

- -

Convert the SpatialPolygonsDataframe to a dataframe.

-
shp_storm_surge <- shp_to_df(gis_surge$result$al092008_2008091112_gt5) 
-
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
-
## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
-
## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-
-## Warning in bind_rows_(x, .id): binding character and factor vector,
-## coercing into character vector
-

Probability of storm surge greater than five feet.

-
bpi + geom_point(data = shp_storm_surge, 
-                aes(x = long, y = lat, color = ProbSurge05), size = 1) + 
-    theme(legend.position = "bottom", 
-          legend.box = "vertical") +
-    labs(title = "Probabilistic Storm Surge > 5ft", 
-         caption = sprintf("rrricanes %s", packageVersion("rrricanes")))
-

-
-
- - - -
- - -
- -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - diff --git a/docs/articles/probabilistic_storm_surge_files/figure-html/unnamed-chunk-13-1.png b/docs/articles/probabilistic_storm_surge_files/figure-html/unnamed-chunk-13-1.png deleted file mode 100644 index 43589f5d..00000000 Binary files a/docs/articles/probabilistic_storm_surge_files/figure-html/unnamed-chunk-13-1.png and /dev/null differ diff --git a/docs/articles/wind_pressure.html b/docs/articles/wind_pressure.html deleted file mode 100644 index ae42fc1b..00000000 --- a/docs/articles/wind_pressure.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - -Wind and Pressure • rrricanes - - - - - - - - - - -
-
- - - -
-
- - - - -
library(dplyr)
-library(gganimate)
-library(ggplot2)
-library(rrricanes)
-library(rrricanesdata)
-library(tidyr)
- -
-

-Forecast/Advisory Data for Hurricane Ike Adv #42

-
fstadv <- fstadv %>% filter(Key == key, Adv <= adv)
-
-
-

-Wind Profile

-
# Plot wind values
-fstadv %>% ggplot(aes(x = Date, y = Wind)) + 
-  geom_line() + 
-  geom_point(aes(color = Status), size = 3) + 
-  scale_y_continuous(name = "Wind (kts)") + 
-  theme_bw() + 
-  theme(legend.position = "bottom", 
-        legend.box = "vertical") +
-  labs(title = "Wind Profile", 
-       caption = sprintf("rrricanes %s", packageVersion("rrricanes")))
-

-
-
-

-Pressure Profile

-
# Plot pressure values
-fstadv %>% ggplot(aes(x = Date, y = Pressure)) + 
-  geom_line() + 
-  geom_point(aes(color = Status), size = 3) + 
-  scale_y_continuous(name = "Pressure (mb)") + 
-  theme_bw() + 
-  theme(legend.position = "bottom", 
-        legend.box = "vertical") +
-  labs(title = "Pressure Profile", 
-       caption = sprintf("rrricanes %s", packageVersion("rrricanes")))
-

-
-
-

-Wind/Pressure Relational Change

-
fstadv %>%
-  mutate(WindDist = (Wind - min(Wind))/(max(Wind) - min(Wind)),
-         PressDist = (Pressure - max(Pressure))/(max(Pressure) - min(Pressure))) %>%
-  gather(Var, Val, WindDist, PressDist) %>% 
-  ggplot(aes(x = Date, y = Val, group = Var, color = Var)) + 
-  geom_line(size = 1) + 
-  scale_color_discrete(labels = c("Pressure Change", "Wind Change")) + 
-  theme_bw() + 
-  theme(legend.position = "bottom", 
-        legend.title = element_blank()) + 
-  labs(title = "Wind/Pressure Relational Change", 
-       subtitle = "",
-       caption = sprintf("rrricanes %s", packageVersion("rrricanes")), 
-       y = "")
-

-
-
-

-Wind Radius

-
wr_animate <- 
-  fstadv %>% 
-  tidy_wr() %>% 
-  gather(Quadrant, Radius, NE:NW) %>% 
-  ggplot(
-    aes(
-      x = Quadrant, 
-      y = Radius, 
-      fill = factor(WindField), 
-      frame = Adv
-    )
-  ) + 
-  geom_bar(stat = "identity", position = "identity", width = 1) + 
-  guides(fill = guide_legend(title = "Wind Field")) +
-  coord_polar() + 
-  theme_minimal() + 
-  theme(legend.position = "bottom") + 
-  labs(
-    title = "Wind Radius for Advisory {frame}", 
-    subtitle = "Minimum sustained one-minute wind speed in knots",
-    caption = sprintf("rrricanes %s", packageVersion("rrricanes")), 
-    y = "Radius (nm)"
-  ) + 
-  transition_time(Date) + 
-  ease_aes('linear')
-
-animate(wr_animate, renderer = magick_renderer())
-

-

One of the interesting things to note about the image above; Hurricane Ike was known for it’s very large wind field (relatively speaking) which generated a larger and wider storm surge than normal for it’s classification. You can see this very well defined structure expansion between advisories 38 and 42.

-

This, in part, led to the modification of the Saffir Simpson Hurricane Scale.

-
-

the very large Hurricane Ike (with hurricane force winds extending as much as 125 mi from the center) in 2008 made landfall in Texas as a Category 2 hurricane and had peak storm surge values of about 20 ft. In contrast, tiny Hurricane Charley (with hurricane force winds extending at most 25 mi from the center) struck Florida in 2004 as a Category 4 hurricane and produced a peak storm surge of only about 7 ft. These storm surge values were substantially outside of the ranges suggested in the original scale. Thus to help reduce public confusion about the impacts associated with the various hurricane categories as well as to provide a more scientifically defensible scale, the storm surge ranges, flooding impact and central pressure statements are being removed from the scale and only peak winds are employed in this revised version – the Saffir-Simpson Hurricane Wind Scale. (Schott et al. 2012)

-
-
-
-

-References

-
-
-

Schott, Timothy, Chris Landsea, Gene Hafele, Jeffrey Lorens, Arthur Taylor, Harvey Thurm, Bill Ward, Mark Willis, and Walt Zaleski. 2012. “The Saffir-Simpson Hurricane Wind Scale.” http://www.nhc.noaa.gov/pdf/sshws.pdf.

-
-
-
-
- - - -
- - -
- -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - diff --git a/docs/articles/wind_pressure_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/wind_pressure_files/figure-html/unnamed-chunk-4-1.png deleted file mode 100644 index 95014aa0..00000000 Binary files a/docs/articles/wind_pressure_files/figure-html/unnamed-chunk-4-1.png and /dev/null differ diff --git a/docs/articles/wind_pressure_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/wind_pressure_files/figure-html/unnamed-chunk-5-1.png deleted file mode 100644 index 796159bc..00000000 Binary files a/docs/articles/wind_pressure_files/figure-html/unnamed-chunk-5-1.png and /dev/null differ diff --git a/docs/articles/wind_pressure_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/wind_pressure_files/figure-html/unnamed-chunk-6-1.png deleted file mode 100644 index 1809b221..00000000 Binary files a/docs/articles/wind_pressure_files/figure-html/unnamed-chunk-6-1.png and /dev/null differ diff --git a/docs/articles/wind_pressure_files/figure-html/unnamed-chunk-7-1.gif b/docs/articles/wind_pressure_files/figure-html/unnamed-chunk-7-1.gif deleted file mode 100644 index 4a964db2..00000000 Binary files a/docs/articles/wind_pressure_files/figure-html/unnamed-chunk-7-1.gif and /dev/null differ diff --git a/docs/articles/wind_speed_probabilities.html b/docs/articles/wind_speed_probabilities.html deleted file mode 100644 index eecbac40..00000000 --- a/docs/articles/wind_speed_probabilities.html +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - -Wind Speed Probabilities • rrricanes - - - - - - - - - - -
-
- - - -
-
- - - - -
library(dplyr)
-library(ggplot2)
-library(rrricanes)
-library(rrricanesdata)
-library(sp)
- -
wndprb <- wndprb %>% filter(Key == key, Adv <= adv)
-
-

-GIS Advisory Forecast Track, Cone of Uncertainty, and Watches/Warnings

-
gis_adv <- gis_advisory(key = key, advisory = adv) %>% gis_download()
-
## OGR data source with driver: ESRI Shapefile 
-## Source: "/tmp/RtmplTbZV0", layer: "al092008.042_5day_lin"
-## with 2 features
-## It has 9 fields
-## OGR data source with driver: ESRI Shapefile 
-## Source: "/tmp/RtmplTbZV0", layer: "al092008.042_5day_pgn"
-## with 2 features
-## It has 9 fields
-## OGR data source with driver: ESRI Shapefile 
-## Source: "/tmp/RtmplTbZV0", layer: "al092008.042_5day_pts"
-## with 13 features
-## It has 20 fields
-## OGR data source with driver: ESRI Shapefile 
-## Source: "/tmp/RtmplTbZV0", layer: "al092008.042_ww_wwlin"
-## with 5 features
-## It has 10 fields
-

Get bounding box of the forecast polygon.

-
bbox <- bbox(gis_adv$al092008.042_5day_pgn)
-bbox
-
##         min       max
-## x -98.10178 -80.20625
-## y  25.25667  41.78703
-
-
-

-Build a Tracking Chart

-

Generate a base plot of the Atlantic ocean.

-
bp <- al_tracking_chart(color = "black", fill = "white", size = 0.1, res = 50)
-
## Regions defined for each Polygons
-## Regions defined for each Polygons
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
- -

-

I like to add a little cushion for the map inset and forecast cone data.

- -

Build a thin tracking map for the inset.

- -

Modify original bp zoomed in on our area of interest.

-
bp <- bp +
-    coord_equal(xlim = c(lon_min, lon_max),
-                ylim = c(lat_min, lat_max)) +
-    scale_x_continuous(expand = c(0, 0)) +
-    scale_y_continuous(expand = c(0, 0)) +
-    labs(x = "Lon",
-         y = "Lat",
-         caption = sprintf("rrricanes %s", packageVersion("rrricanes")))
-
## Coordinate system already present. Adding new coordinate system, which will replace the existing one.
- -

-

Combine bp and bp_inset to finalize initial base plot. bp will be a base plot without the inset. bpi will have the inset.

- -

-

The wndprb will not have coordinates for cities. An option is al_prblty_stations. However, please note this function may become deprecated.

-
wndprb <- 
-    wndprb %>% 
-    left_join(al_prblty_stations(), by = "Location") %>% 
-    mutate_at(.vars = c("Lat", "Lon"), .funs = as.numeric)
-
## Warning: Expected 7 pieces. Additional pieces discarded in 1 rows [90].
-

Check wndprb for NA values in Lat, Lon.

-
any(is.na(wndprb$Lat), is.na(wndprb$Lon))
-
## [1] TRUE
-
wndprb_adv42 <- filter(wndprb, Adv == adv, Wind >= 64)
-
-bpi +
-    geom_point(
-        data = wndprb_adv42, 
-        aes(
-            x = Lon,
-            y = Lat, 
-            color = Wind120Cum,
-            size = Wind120Cum
-        )
-    ) + 
-    scale_color_gradientn(colors = terrain.colors(10)) + 
-    guides(size = FALSE) + 
-    theme(
-        legend.position = "bottom", 
-        legend.box = "vertical"
-    ) + 
-    labs(title = "Total Probability of Wind >= 64kts within 120 Hours")
-

-
-
- - - -
- - -
- -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - diff --git a/docs/articles/wind_speed_probabilities_files/figure-html/unnamed-chunk-10-1.png b/docs/articles/wind_speed_probabilities_files/figure-html/unnamed-chunk-10-1.png deleted file mode 100644 index fcb95fa5..00000000 Binary files a/docs/articles/wind_speed_probabilities_files/figure-html/unnamed-chunk-10-1.png and /dev/null differ diff --git a/docs/articles/wind_speed_probabilities_files/figure-html/unnamed-chunk-13-1.png b/docs/articles/wind_speed_probabilities_files/figure-html/unnamed-chunk-13-1.png deleted file mode 100644 index 68b6c7bc..00000000 Binary files a/docs/articles/wind_speed_probabilities_files/figure-html/unnamed-chunk-13-1.png and /dev/null differ diff --git a/docs/articles/wind_speed_probabilities_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/wind_speed_probabilities_files/figure-html/unnamed-chunk-6-1.png deleted file mode 100644 index 692b1bb7..00000000 Binary files a/docs/articles/wind_speed_probabilities_files/figure-html/unnamed-chunk-6-1.png and /dev/null differ diff --git a/docs/articles/wind_speed_probabilities_files/figure-html/unnamed-chunk-9-1.png b/docs/articles/wind_speed_probabilities_files/figure-html/unnamed-chunk-9-1.png deleted file mode 100644 index 2a9d82d1..00000000 Binary files a/docs/articles/wind_speed_probabilities_files/figure-html/unnamed-chunk-9-1.png and /dev/null differ diff --git a/docs/authors.html b/docs/authors.html deleted file mode 100644 index cb1a075b..00000000 --- a/docs/authors.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - -Authors • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
    -
  • -

    Tim Trice. Author, maintainer. -

    -
  • -
  • -

    Joseph Stachelek. Reviewer. -
    Joseph Stachelek reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/118

    -
  • -
  • -

    Emily Robinson. Reviewer. -
    Emily Robinson reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/118

    -
  • -
- -
- -
- - -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - diff --git a/docs/docsearch.css b/docs/docsearch.css deleted file mode 100644 index e5f1fe1d..00000000 --- a/docs/docsearch.css +++ /dev/null @@ -1,148 +0,0 @@ -/* Docsearch -------------------------------------------------------------- */ -/* - Source: https://github.com/algolia/docsearch/ - License: MIT -*/ - -.algolia-autocomplete { - display: block; - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1 -} - -.algolia-autocomplete .ds-dropdown-menu { - width: 100%; - min-width: none; - max-width: none; - padding: .75rem 0; - background-color: #fff; - background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, .1); - box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); -} - -@media (min-width:768px) { - .algolia-autocomplete .ds-dropdown-menu { - width: 175% - } -} - -.algolia-autocomplete .ds-dropdown-menu::before { - display: none -} - -.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { - padding: 0; - background-color: rgb(255,255,255); - border: 0; - max-height: 80vh; -} - -.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { - margin-top: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion { - padding: 0; - overflow: visible -} - -.algolia-autocomplete .algolia-docsearch-suggestion--category-header { - padding: .125rem 1rem; - margin-top: 0; - font-size: 1.3em; - font-weight: 500; - color: #00008B; - border-bottom: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { - float: none; - padding-top: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { - float: none; - width: auto; - padding: 0; - text-align: left -} - -.algolia-autocomplete .algolia-docsearch-suggestion--content { - float: none; - width: auto; - padding: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--content::before { - display: none -} - -.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { - padding-top: .75rem; - margin-top: .75rem; - border-top: 1px solid rgba(0, 0, 0, .1) -} - -.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { - display: block; - padding: .1rem 1rem; - margin-bottom: 0.1; - font-size: 1.0em; - font-weight: 400 - /* display: none */ -} - -.algolia-autocomplete .algolia-docsearch-suggestion--title { - display: block; - padding: .25rem 1rem; - margin-bottom: 0; - font-size: 0.9em; - font-weight: 400 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--text { - padding: 0 1rem .5rem; - margin-top: -.25rem; - font-size: 0.8em; - font-weight: 400; - line-height: 1.25 -} - -.algolia-autocomplete .algolia-docsearch-footer { - width: 110px; - height: 20px; - z-index: 3; - margin-top: 10.66667px; - float: right; - font-size: 0; - line-height: 0; -} - -.algolia-autocomplete .algolia-docsearch-footer--logo { - background-image: url("data:image/svg+xml;utf8,"); - background-repeat: no-repeat; - background-position: 50%; - background-size: 100%; - overflow: hidden; - text-indent: -9000px; - width: 100%; - height: 100%; - display: block; - transform: translate(-8px); -} - -.algolia-autocomplete .algolia-docsearch-suggestion--highlight { - color: #FF8C00; - background: rgba(232, 189, 54, 0.1) -} - - -.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { - box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) -} - -.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { - background-color: rgba(192, 192, 192, .15) -} diff --git a/docs/docsearch.js b/docs/docsearch.js deleted file mode 100644 index b35504cd..00000000 --- a/docs/docsearch.js +++ /dev/null @@ -1,85 +0,0 @@ -$(function() { - - // register a handler to move the focus to the search bar - // upon pressing shift + "/" (i.e. "?") - $(document).on('keydown', function(e) { - if (e.shiftKey && e.keyCode == 191) { - e.preventDefault(); - $("#search-input").focus(); - } - }); - - $(document).ready(function() { - // do keyword highlighting - /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ - var mark = function() { - - var referrer = document.URL ; - var paramKey = "q" ; - - if (referrer.indexOf("?") !== -1) { - var qs = referrer.substr(referrer.indexOf('?') + 1); - var qs_noanchor = qs.split('#')[0]; - var qsa = qs_noanchor.split('&'); - var keyword = ""; - - for (var i = 0; i < qsa.length; i++) { - var currentParam = qsa[i].split('='); - - if (currentParam.length !== 2) { - continue; - } - - if (currentParam[0] == paramKey) { - keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); - } - } - - if (keyword !== "") { - $(".contents").unmark({ - done: function() { - $(".contents").mark(keyword); - } - }); - } - } - }; - - mark(); - }); -}); - -/* Search term highlighting ------------------------------*/ - -function matchedWords(hit) { - var words = []; - - var hierarchy = hit._highlightResult.hierarchy; - // loop to fetch from lvl0, lvl1, etc. - for (var idx in hierarchy) { - words = words.concat(hierarchy[idx].matchedWords); - } - - var content = hit._highlightResult.content; - if (content) { - words = words.concat(content.matchedWords); - } - - // return unique words - var words_uniq = [...new Set(words)]; - return words_uniq; -} - -function updateHitURL(hit) { - - var words = matchedWords(hit); - var url = ""; - - if (hit.anchor) { - url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; - } else { - url = hit.url + '?q=' + escape(words.join(" ")); - } - - return url; -} diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 177bce15..00000000 --- a/docs/index.html +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - -Web scraper for Atlantic and east Pacific hurricanes and tropical storms • rrricanes - - - - - - - - - - -
-
- - - -
-
- - - - - -
- -

rrricanes is a R library that extracts information from available archives on past and current tropical cyclones. Currently, archives date back to 1998.

-

Data can be obtained for cyclones in the north Atlantic (considered the Atlantic Basin) and north-eastern Pacific (the East Pacific Basin from 140°W and eastward.

-

Central Pacific data (140°W to 180°W) is included if issued by the National Hurricane Center (generally they’re issued by the Central Pacific Hurricane Center).

-

This library parses the text advisories of all tropical cyclones since 1998. Over the years the formats of the text products have changed and many are loosely formatted.

-

I wrote this package with the goal of consolidating messy text data into well-organized formats that can easily be saved to CSV, SQL and other data formats.

-

You may explore some features of the package through the shinycanes beta web application (built with R Shiny).

-
-

-Advisory Products

-

Generally speaking, there are five products available for tropical cyclones issued at 03:00, 09:00, 15:00 and 21:00 UTC;

-
    -
  1. Storm Discussion - These are technical discussions centered on the current structure of the cyclone, satellite presentation, computer forecast model tendencies and more.

  2. -
  3. Forecast/Adivsory - This data-rich product lists the current location of the cyclone, its wind structure, forecast and forecast wind structure.

  4. -
  5. Public Advisory - These are general text statements issued for the public-at-large. Information in these products is a summary of the Forecast/Advisory product along with any watches and warnings issued, changed, or cancelled. Public Advisory products are the only regularly-scheduled product that may be issued intermittently (every three hours and, occasionally, every two hours) when watches and warnings are in effect.

  6. -
  7. Wind Speed Probabilities - These products list the probability of a minimum sustained wind speed expected in a given forecast window. This product replaces the Strike Probabilities product beginning in 2006 (see below).

  8. -
  9. Updates - Tropical Cyclone Updates may be issued at any time if a storm is an immediate threat to land or if the cyclone undergoes a significant change of strength or structure. The information in this product is general.

  10. -
-

Discontinued Products

-

These products are included in the package though they have been discontinued at some point:

-
    -
  1. Strike Probabilities - List the probability of a tropical cyclone passing within 65 nautical miles of a location within a forecast window. Replaced in 2006 by the Wind Speed Probabilities product.

  2. -
  3. Position Estimates - Typically issued as a storm is threatening land but generally rare (see Hurricane Ike 2008, Key AL092008). It is generally just an update of the current location of the cyclone. After the 2011 hurricane season, this product was discontinued; Updates are now issued in their place.

  4. -
-
-
-

-Getting Started

-

Please view the vignette ‘Getting Started’:

-
vignette("getting_started", package = "rrricanes")
-

Online documentation is also available.

-
-

-Prerequisites

-

rrricanes requires an active internet connection as data is extracted from online sources.

-

Linux users must also have the libgdal-dev, libproj-dev and libxml2-dev packages installed.

-

To add rrricanesdata, a package of post-scraped datasets,

- -

To use high resolution tracking maps you will need to install the rnaturalearthhires package.

- -
-
-

-Installing

-

rrricanes is currently only available in GitHub. It can be installed using the devtools package:

-
devtools::install_github("ropensci/rrricanes", build_vignettes = TRUE)
-
-
-
-

-Built With

-
    -
  • -R 3.3.3 - The R Project for Statistical Computing
  • -
-
-
-

-Contributing

-

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

-
-
-

-Versioning

-

We use SemVer for versioning. For the versions available, see the tags on this repository.

-
-
-

-Authors

-
    -
  • -Tim Trice - Initial work - timtrice -
  • -
-

See also the list of contributors who participated in this project.

-
-
-

-License

-

This project is licensed under the MIT License - see the LICENSE.md file for details

-
- -
-

-Known Data Quality Issues

-
    -
  1. Hurricane Juan (AL152003), Adv 15; no status leads to improper Status and Name values in some datasets. (#82)
  2. -
-
-
-
- - - -
- - -
- -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - diff --git a/docs/link.svg b/docs/link.svg deleted file mode 100644 index 88ad8276..00000000 --- a/docs/link.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/docs/logo.png b/docs/logo.png deleted file mode 100644 index 65bec986..00000000 Binary files a/docs/logo.png and /dev/null differ diff --git a/docs/news/index.html b/docs/news/index.html deleted file mode 100644 index 53d58d14..00000000 --- a/docs/news/index.html +++ /dev/null @@ -1,539 +0,0 @@ - - - - - - - - -Changelog • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- -
-
- - -
-

-rrricanes 0.2.0-6 (2017-07-16)

-
-

-NEW FEATURES

-
    -
  • NA
  • -
-
-
-

-MINOR IMPROVEMENTS

-
    -
  • -get_storms and get_storm_data have been rewritten to utilize pkg crul’s asynchronous features. This will not make much of a difference in get_storms (and may actually be slightly slower; to be explained). But the difference with get_storm_data should be very noticeable. There is a limit to hitting the NHC archives; 80 requests per 10 seconds. Both functions send 4 links through every 0.5 seconds to avoid this limit. Timeout issues should no longer occur so options rrricanes.http_attempts and rrricanes.http_timeout have been removed. The primary cause of long processing now is due to scraping, particularly with the fstadv products; the amount of data in these products and the unstructured nature of the products require a number of rules. This can probably be simplified in future releases. (#94)
  • -
-
-
-

-BUG FIXES

-
    -
  • NA
  • -
-
-
-

-DEPRECATED AND DEFUNCT

-
    -
  • -load_storm_data has been removed in favor of loading rrricanesdata. See vignette “installing_rrricanesdata” for more information.
  • -
-
-
-
-

-rrricanes 0.2.0-5 (2017-07-08)

-
-

-NEW FEATURES

-
    -
  • NA
  • -
-
-
-

-MINOR IMPROVEMENTS

- -
-
-

-BUG FIXES

-
    -
  • NA
  • -
-
-
-

-DEPRECATED AND DEFUNCT

-
    -
  • NA
  • -
-
-
-
-

-rrricanes 0.2.0-4 (2017-06-25)

-
-

-NEW FEATURES

-
    -
  • NA
  • -
-
-
-

-MINOR IMPROVEMENTS

-
    -
  • -Key variable added to discus dataframes. Key will be NA for all cyclones >= 2005. Should not be <= 2006. (#80)
  • -
  • Removed Adv variable from posest dataframes. Position estimates do not have advisory numbers. (#81)
  • -
  • Removed Adv variable from update. Updates do not have advisory numbers. (#84)
  • -
  • Added variable Key to get_public dataframes. (#85)
  • -
  • Added variable Key to get_update dataframes. (#86)
  • -
  • Removed non-existent wind radii variables in get_fstadv. Hrs 48 and 72 hours only have 34 and 50kt wind fields. Hrs 96 and 120 have none. (#89)
  • -
-
-
-

-BUG FIXES

-
    -
  • NA
  • -
-
-
-

-DEPRECATED AND DEFUNCT

-
    -
  • NA
  • -
-
-
-
-

-rrricanes 0.2.0-3 (2017-06-22)

-
-

-NEW FEATURES

-
    -
  • NA
  • -
-
-
-

-MINOR IMPROVEMENTS

-
    -
  • Examples for functions knots_to_mph, mb_to_in, status_abbr_to_str, get_discus, get_fstadv, tidy_fstadv, tidy_wr, tidy_fcst and tidy_fcst_wr.
  • -
  • Minor documentation updates
  • -
  • Small enhancements to tests, vignettes
  • -
-
-
-

-BUG FIXES

-
    -
  • NA
  • -
-
-
-

-DEPRECATED AND DEFUNCT

-
    -
  • NA
  • -
-
-
-
-

-rrricanes 0.2.0-2 (2017-06-22)

-
-

-NEW FEATURES

-
    -
  • NA
  • -
-
-
-

-MINOR IMPROVEMENTS

-
    -
  • NA
  • -
-
-
-

-BUG FIXES

-
    -
  • Advisories now issued when tropical cyclone development is anticipated, but not yet occurred, and watches and warnings need to be issued. See AL022017, AL032017.
  • -
  • Added additional time zones (HDT, HST, MDT, MST)
  • -
  • Appended additional headers (TCE, WTPA, MIATCM, MIAWRKAD1, MIAWRKAP)
  • -
-
-
-

-DEPRECATED AND DEFUNCT

-
    -
  • NA
  • -
-
-
-
-

-rrricanes 0.2.0-1 (2017-06-16)

-
-

-NEW FEATURES

-
    -
  • GIS functions now available. Please note some of these products may not exist for every available cyclone/advisory.
  • -
  • -gis_advisory Typically will include current and past track data, forecast track data, forecast cone (margin of error) and wind radius data.
  • -
  • -gis_breakpoints List of breakpoints typically used for watch/warning areas but is not a requirement.
  • -
  • -gis_latest Retrieves the latest GIS products for all active storms.
  • -
  • -gis_outlook Retrives the latest tropical weather outlook in shapefile format.
  • -
  • -gis_prob_storm_surge Probabilistic storm surge; a polygon dataset for psurge and esurge products with various criteria.
  • -
  • -gis_windfield Wind radius datasets.
  • -
  • -gis_wsp Wind speed probabilities
  • -
  • -gis_download Use this function to download the URLs returned from the above functions.
  • -
  • -shp_to_df added to convert lines and polygons spatial dataframes to dataframes. Points dataframes can be converted using tibble::as_dataframe (target the @data object).
  • -
-
-
-

-MINOR IMPROVEMENTS

-
    -
  • -Enhanced documentation added online using pkgdown.
  • -
  • -load_storm_data directly returns dataframes. Additionally, retrieval by basin and years removed in favor of importing complete product datasets. Additionally, documentation has been added to the website on using data.world as a third option. The difference between these two options is load_storm_data will return complete datasets. Using data.world will allow users to write custom queries to retrieve data. (#76)
  • -
-
-
-

-BUG FIXES

-
    -
  • NA
  • -
-
-
-

-DEPRECATED AND DEFUNCT

-
    -
  • Not yet deprecated but a warning that al_prblty_stations, cp_prblty_stations and ep_prblty_stations may be removed on a future release. (#46)
  • -
  • Support for dplyr 0.5.0 will be removed in future releases in favor of dplyr 0.7.0.
  • -
-
-
-
-

-rrricanes 0.1.3 (2017-06-11)

-
-

-NEW FEATURES

-
    -
  • NA
  • -
-
-
-

-MINOR IMPROVEMENTS

-
    -
  • -rrricanes.http_sleep to control time to sleep between multiple HTTP requests.
  • -
  • Clarified documentation for get_fstadv, get_prblty, get_wndprb, tidy_fstadv, tidy_wr, tidy_fcst and tidy_fcst_wr.
  • -
-
-
-

-BUG FIXES

-
    -
  • -tidy_fcst and tidy_fcst_wr would err if all forecast periods were not available for a cyclone. Functions now analyze dataframe to determine what forecast fields exist, then tidies based on the result. (#73)
  • -
-
-
-

-DEPRECATED AND DEFUNCT

-
    -
  • NA
  • -
-
-
-
-

-rrricanes 0.1.2 (2017-06-08)

-
-

-NEW FEATURES

-
    -
  • Changed name from Hurricanes to rrricanes.

  • -
  • get_storm_data can now be chained to other commands and returns a list of dataframes.

  • -
  • load_storm_data accesses pre-scraped datasets and returns requested products through the github repo rrricanesdata. This was done to make it quicker to get data. It should not be relied on to get the most immediate data for current storms. However, it should be fairly up-to-date. Original functions can be used if for some reason immediate data access is needed.

  • -
  • saffir returns Saffir-Simpson classification of tropical cyclones; abbreviated.

  • -
  • status_abbr_to_str converts storm status abbreviations (i.e., TD, TS, HU) to string.

  • -
  • twoal and twoep parse tropical weather outlook XML files. Gives current status, if any, of areas of interest in either basin.

  • -
-
-
-

-MINOR IMPROVEMENTS

-
    -
  • Modified numerous regex patterns to ensure data quality.
  • -
  • -tidy_fstadv, tidy_wr, tidy_fcst and tidy_fcst_wr have been added to replaced now-removed fstadv_split().
  • -
  • Added loop to make multiple attempts at extracting contents from NHC archives. Options rrricanes.http_timeout and rrricanes.http_attempts added to give user more control over this. Default is 3 attempts with no more than 5 permitted.
  • -
-
-
-

-BUG FIXES

-
    -
  • Too many to recall. Apologies.
  • -
  • Call to get_storms on some linux distros generated xpath_element error. Corrected. (#67)
  • -
  • Modify call to get_storm_data. Replaced css parameter in rvest::html_nodes calls with xpath parameter. Some products (notably, get_prblty) do not have a “pre” tag but are text documents (not HTML). Modified scrape_contents to return full contents if “pre” tag doesn’t exist. Tested get_discus and get_public; no errors generated. (#68)
  • -
-
-
-

-DEPRECATED AND DEFUNCT

-
    -
  • -fstadv_split. See MINOR IMPROVEMENTS for alternatives.
  • -
-
-
-
-

-Hurricanes 0.1.0 (2017-05-12)

-
-

-Major new features

-

Retrieve all storm’s for a given year (>=1998) and access data from a given storm’s history. Can access “current” storm position, structure details, forecast, and discussions.

-

This release should be considered beta. While I’ve made every effort to ensure quality there may be an issue here or there. I will work on developing QA/QC scripts as time permits.

-

Please send any issues or questions to: https://github.com/timtrice/Hurricanes/issues.

-
-

-Getting Annual Storm Data

-

Use get_storms to access storm’s for a given year.

-
-
-

-Getting Storm Data

-

Use get_storm_data to access one or multiple products for a specific storm.

-
-

-Storm Discussions (discus)

-

Not parsed but contains technical information on the cyclone, development tendencies and forecast model tendencies.

-
-
-

-Forecast/Advisory (fstadv)

-

Contains the meat of data. Current storm information, forecast information, wind and sea data. Can use fstadv_split() to break the wide dataframe to multiple, relational dataframes.

-
-
-

-Position Estimate (posest)

-

Contains current position estimate for a given storm. Usually issued during threats to land. Not issued for all storms. Not parsed.

-
-
-

-Strike Probabilities (prblty)

-

Strike probabilities for given locations prior to 2006 (See Wind Speed Probabilities for >= 2006).

-
-
-

-Public Advisory (public)

-

General information on a storm. Not parsed.

-
-
-

-Updates (update)

-

Quick information given when a storm is threatening or undergoes a significant change. Not issued for all storms.

-
-
-

-Wind Probabilities (wndprb)

-

Replaced Strike Probabilities after the 2005 hurricane season. Lists the chances of a location seeing 34kt, 50kt and 64kt winds within a given time frame.

-
-
-
-
-
- - - -
- -
- - -
-

Site built with pkgdown 1.3.0.

-
-
-
- - - - - - diff --git a/docs/pkgdown.css b/docs/pkgdown.css deleted file mode 100644 index c03fb08d..00000000 --- a/docs/pkgdown.css +++ /dev/null @@ -1,236 +0,0 @@ -/* Sticky footer */ - -/** - * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ - * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css - * - * .Site -> body > .container - * .Site-content -> body > .container .row - * .footer -> footer - * - * Key idea seems to be to ensure that .container and __all its parents__ - * have height set to 100% - * - */ - -html, body { - height: 100%; -} - -body > .container { - display: flex; - height: 100%; - flex-direction: column; - - padding-top: 60px; -} - -body > .container .row { - flex: 1 0 auto; -} - -footer { - margin-top: 45px; - padding: 35px 0 36px; - border-top: 1px solid #e5e5e5; - color: #666; - display: flex; - flex-shrink: 0; -} -footer p { - margin-bottom: 0; -} -footer div { - flex: 1; -} -footer .pkgdown { - text-align: right; -} -footer p { - margin-bottom: 0; -} - -img.icon { - float: right; -} - -img { - max-width: 100%; -} - -/* Fix bug in bootstrap (only seen in firefox) */ -summary { - display: list-item; -} - -/* Typographic tweaking ---------------------------------*/ - -.contents .page-header { - margin-top: calc(-60px + 1em); -} - -/* Section anchors ---------------------------------*/ - -a.anchor { - margin-left: -30px; - display:inline-block; - width: 30px; - height: 30px; - visibility: hidden; - - background-image: url(./link.svg); - background-repeat: no-repeat; - background-size: 20px 20px; - background-position: center center; -} - -.hasAnchor:hover a.anchor { - visibility: visible; -} - -@media (max-width: 767px) { - .hasAnchor:hover a.anchor { - visibility: hidden; - } -} - - -/* Fixes for fixed navbar --------------------------*/ - -.contents h1, .contents h2, .contents h3, .contents h4 { - padding-top: 60px; - margin-top: -40px; -} - -/* Static header placement on mobile devices */ -@media (max-width: 767px) { - .navbar-fixed-top { - position: absolute; - } - .navbar { - padding: 0; - } -} - - -/* Sidebar --------------------------*/ - -#sidebar { - margin-top: 30px; -} -#sidebar h2 { - font-size: 1.5em; - margin-top: 1em; -} - -#sidebar h2:first-child { - margin-top: 0; -} - -#sidebar .list-unstyled li { - margin-bottom: 0.5em; -} - -.orcid { - height: 16px; - vertical-align: middle; -} - -/* Reference index & topics ----------------------------------------------- */ - -.ref-index th {font-weight: normal;} - -.ref-index td {vertical-align: top;} -.ref-index .icon {width: 40px;} -.ref-index .alias {width: 40%;} -.ref-index-icons .alias {width: calc(40% - 40px);} -.ref-index .title {width: 60%;} - -.ref-arguments th {text-align: right; padding-right: 10px;} -.ref-arguments th, .ref-arguments td {vertical-align: top;} -.ref-arguments .name {width: 20%;} -.ref-arguments .desc {width: 80%;} - -/* Nice scrolling for wide elements --------------------------------------- */ - -table { - display: block; - overflow: auto; -} - -/* Syntax highlighting ---------------------------------------------------- */ - -pre { - word-wrap: normal; - word-break: normal; - border: 1px solid #eee; -} - -pre, code { - background-color: #f8f8f8; - color: #333; -} - -pre code { - overflow: auto; - word-wrap: normal; - white-space: pre; -} - -pre .img { - margin: 5px 0; -} - -pre .img img { - background-color: #fff; - display: block; - height: auto; -} - -code a, pre a { - color: #375f84; -} - -a.sourceLine:hover { - text-decoration: none; -} - -.fl {color: #1514b5;} -.fu {color: #000000;} /* function */ -.ch,.st {color: #036a07;} /* string */ -.kw {color: #264D66;} /* keyword */ -.co {color: #888888;} /* comment */ - -.message { color: black; font-weight: bolder;} -.error { color: orange; font-weight: bolder;} -.warning { color: #6A0366; font-weight: bolder;} - -/* Clipboard --------------------------*/ - -.hasCopyButton { - position: relative; -} - -.btn-copy-ex { - position: absolute; - right: 0; - top: 0; - visibility: hidden; -} - -.hasCopyButton:hover button.btn-copy-ex { - visibility: visible; -} - -/* mark.js ----------------------------*/ - -mark { - background-color: rgba(255, 255, 51, 0.5); - border-bottom: 2px solid rgba(255, 153, 51, 0.3); - padding: 1px; -} - -/* vertical spacing after htmlwidgets */ -.html-widget { - margin-bottom: 10px; -} diff --git a/docs/pkgdown.js b/docs/pkgdown.js deleted file mode 100644 index eb7e83d2..00000000 --- a/docs/pkgdown.js +++ /dev/null @@ -1,115 +0,0 @@ -/* http://gregfranko.com/blog/jquery-best-practices/ */ -(function($) { - $(function() { - - $("#sidebar") - .stick_in_parent({offset_top: 40}) - .on('sticky_kit:bottom', function(e) { - $(this).parent().css('position', 'static'); - }) - .on('sticky_kit:unbottom', function(e) { - $(this).parent().css('position', 'relative'); - }); - - $('body').scrollspy({ - target: '#sidebar', - offset: 60 - }); - - $('[data-toggle="tooltip"]').tooltip(); - - var cur_path = paths(location.pathname); - var links = $("#navbar ul li a"); - var max_length = -1; - var pos = -1; - for (var i = 0; i < links.length; i++) { - if (links[i].getAttribute("href") === "#") - continue; - // Ignore external links - if (links[i].host !== location.host) - continue; - - var nav_path = paths(links[i].pathname); - - var length = prefix_length(nav_path, cur_path); - if (length > max_length) { - max_length = length; - pos = i; - } - } - - // Add class to parent
  • , and enclosing
  • if in dropdown - if (pos >= 0) { - var menu_anchor = $(links[pos]); - menu_anchor.parent().addClass("active"); - menu_anchor.closest("li.dropdown").addClass("active"); - } - }); - - function paths(pathname) { - var pieces = pathname.split("/"); - pieces.shift(); // always starts with / - - var end = pieces[pieces.length - 1]; - if (end === "index.html" || end === "") - pieces.pop(); - return(pieces); - } - - // Returns -1 if not found - function prefix_length(needle, haystack) { - if (needle.length > haystack.length) - return(-1); - - // Special case for length-0 haystack, since for loop won't run - if (haystack.length === 0) { - return(needle.length === 0 ? 0 : -1); - } - - for (var i = 0; i < haystack.length; i++) { - if (needle[i] != haystack[i]) - return(i); - } - - return(haystack.length); - } - - /* Clipboard --------------------------*/ - - function changeTooltipMessage(element, msg) { - var tooltipOriginalTitle=element.getAttribute('data-original-title'); - element.setAttribute('data-original-title', msg); - $(element).tooltip('show'); - element.setAttribute('data-original-title', tooltipOriginalTitle); - } - - if(ClipboardJS.isSupported()) { - $(document).ready(function() { - var copyButton = ""; - - $(".examples, div.sourceCode").addClass("hasCopyButton"); - - // Insert copy buttons: - $(copyButton).prependTo(".hasCopyButton"); - - // Initialize tooltips: - $('.btn-copy-ex').tooltip({container: 'body'}); - - // Initialize clipboard: - var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { - text: function(trigger) { - return trigger.parentNode.textContent; - } - }); - - clipboardBtnCopies.on('success', function(e) { - changeTooltipMessage(e.trigger, 'Copied!'); - e.clearSelection(); - }); - - clipboardBtnCopies.on('error', function() { - changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); - }); - }); - } -})(window.jQuery || window.$) diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml deleted file mode 100644 index 2ed70fab..00000000 --- a/docs/pkgdown.yml +++ /dev/null @@ -1,16 +0,0 @@ -pandoc: 2.3.1 -pkgdown: 1.3.0 -pkgdown_sha: ~ -articles: - accumulated_cyclone_energy: accumulated_cyclone_energy.html - forecast_advisory: forecast_advisory.html - getting_started: getting_started.html - gis_data: gis_data.html - installing_rrricanesdata: installing_rrricanesdata.html - probabilistic_storm_surge: probabilistic_storm_surge.html - wind_pressure: wind_pressure.html - wind_speed_probabilities: wind_speed_probabilities.html -urls: - reference: https://ropensci.github.io/rrricanes//reference - article: https://ropensci.github.io/rrricanes//articles - diff --git a/docs/reference/al_prblty_stations.html b/docs/reference/al_prblty_stations.html deleted file mode 100644 index 72a4aa28..00000000 --- a/docs/reference/al_prblty_stations.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - -al_prblty_stations — al_prblty_stations • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Retrieve list of probability stations based in the Atlantic -basin from the NHC. To be used in tandem with `wndprb` products.

    - -
    - -
    al_prblty_stations()
    - -

    Details

    - -

    Originally it was believed this data source would be removed by the -National Hurricane Center but it appears to have been updated. Additional -columns have been added, one up front and three in the back. These columns -all contain the same values each and I am unable to find documentation -describing the values.

    -

    Regardless, the data is kept, just in case.

    - -

    Warnings

    - - -

    Calling al_prblty_stations will generate a warning:

    -

    > "Expected 7 pieces. Additional pieces discarded in 1 rows [90]."

    -

    Station PATRICK AFB actually has eight columns. The data is kept for -consistency; you decide if you want it or not.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/al_tracking_chart.html b/docs/reference/al_tracking_chart.html deleted file mode 100644 index 9fcbf411..00000000 --- a/docs/reference/al_tracking_chart.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - - - -al_tracking_chart — al_tracking_chart • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Build tracking chart centered on Atlantic Basin.

    - -
    - -
    al_tracking_chart(...)
    - -

    Arguments

    - - - - - - -
    ...

    Additional parameters for tracking_chart and ggplot2

    - -

    Value

    - -

    ggplot2 object centered on Atlantic basin.

    - -

    See also

    - - - - -

    Examples

    -
    # NOT RUN {
    -# Build map with white land areas, thin black borders
    -al_tracking_chart(color = "black", size = 0.1, fill = "white")
    -
    -# 50nm resolution, no states
    -al_tracking_chart(res = 50, states = FALSE, color = "black", size = 0.1,
    -          fill = "white")
    -
    -# 50nm resolution, coastlines only
    -al_tracking_chart(countries = FALSE, res = 50, color = "black", size = 0.1,
    -          fill = "white")
    -
    -# Adding and modifying with ggplot functions
    -al_tracking_chart(color = "black", size = 0.1, fill = "white") +
    -  ggplot2::labs(x = "Lon", y = "Lat",
    -  title = "Base Atlantic Tracking Chart")
    -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/cp_prblty_stations.html b/docs/reference/cp_prblty_stations.html deleted file mode 100644 index 777e84df..00000000 --- a/docs/reference/cp_prblty_stations.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - -cp_prblty_stations — cp_prblty_stations • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Retrieve list of probability stations based in the central -Pacific from the NHC. To be used in tandem with `wndprb` products.

    - -
    - -
    cp_prblty_stations()
    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/df.al_12_2005_prblty.html b/docs/reference/df.al_12_2005_prblty.html deleted file mode 100644 index 663e3c70..00000000 --- a/docs/reference/df.al_12_2005_prblty.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - -Strike probabilities for Hurricane Katrina (AL122005) — df.al_12_2005_prblty • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Strike probabilities for Hurricane Katrina (AL122005)

    - -
    - -
    df.al_12_2005_prblty
    - -

    Format

    - -

    An object of class tbl_df (inherits from tbl, data.frame) with 937 rows and 10 columns.

    - -

    Source

    - -

    http://www.nhc.noaa.gov/archive/2005/KATRINA.shtml?

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/df.al_18_2012.html b/docs/reference/df.al_18_2012.html deleted file mode 100644 index 0bc9f26f..00000000 --- a/docs/reference/df.al_18_2012.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - -Forecast/Advisory and Wind Speed Probabilities for Hurricane Sandy (AL182012) — df.al_18_2012 • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Forecast/Advisory and Wind Speed Probabilities for Hurricane Sandy (AL182012)

    - -
    - -
    df.al_18_2012
    - -

    Format

    - -

    An object of class list of length 2.

    - -

    Source

    - -

    http://www.nhc.noaa.gov/archive/2012/SANDY.shtml?

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/df.al_18_2012_fstadv.html b/docs/reference/df.al_18_2012_fstadv.html deleted file mode 100644 index 3089a911..00000000 --- a/docs/reference/df.al_18_2012_fstadv.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - -Forecast/Advisory for Hurricane Sandy (AL182012) — df.al_18_2012_fstadv • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Forecast/Advisory for Hurricane Sandy (AL182012)

    - -
    - -
    df.al_18_2012_fstadv
    - -

    Format

    - -

    An object of class tbl_df (inherits from tbl, data.frame) with 31 rows and 117 columns.

    - -

    Source

    - -

    http://www.nhc.noaa.gov/archive/2012/SANDY.shtml?

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/df.al_18_2012_wndprb.html b/docs/reference/df.al_18_2012_wndprb.html deleted file mode 100644 index 3b99c9d5..00000000 --- a/docs/reference/df.al_18_2012_wndprb.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - -Wind speed probabilities for Hurricane Sandy (AL182012) — df.al_18_2012_wndprb • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Wind speed probabilities for Hurricane Sandy (AL182012)

    - -
    - -
    df.al_18_2012_wndprb
    - -

    Format

    - -

    An object of class tbl_df (inherits from tbl, data.frame) with 2227 rows and 18 columns.

    - -

    Source

    - -

    http://www.nhc.noaa.gov/archive/2012/SANDY.shtml?

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/df.al_2012.html b/docs/reference/df.al_2012.html deleted file mode 100644 index 602f88e0..00000000 --- a/docs/reference/df.al_2012.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - -Atlantic cyclones for 2012 — df.al_2012 • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Atlantic cyclones for 2012

    - -
    - -
    df.al_2012
    - -

    Format

    - -

    An object of class tbl_df (inherits from tbl, data.frame) with 19 rows and 4 columns.

    - -

    Source

    - -

    http://www.nhc.noaa.gov/archive/2012/

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/df.gis_adv.html b/docs/reference/df.gis_adv.html deleted file mode 100644 index ad39941a..00000000 --- a/docs/reference/df.gis_adv.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - -GIS advisory dataset for Hurricane Sandy Adv 18 — df.gis_adv • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    GIS advisory dataset for Hurricane Sandy Adv 18

    - -
    - -
    df.gis_adv
    - -

    Format

    - -

    An object of class list of length 4.

    - -

    Source

    - -

    http://www.nhc.noaa.gov/gis/archive_forecast_results.php?id=al18&year=2012&name=Hurricane%20SANDY

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/df.gis_storm_surge.html b/docs/reference/df.gis_storm_surge.html deleted file mode 100644 index 066f2699..00000000 --- a/docs/reference/df.gis_storm_surge.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - -GIS storm surge shapefile dataset for Hurricane Sandy (AL182012) — df.gis_storm_surge • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    GIS storm surge shapefile dataset for Hurricane Sandy (AL182012)

    - -
    - -
    df.gis_storm_surge
    - -

    Format

    - -

    An object of class list of length 1.

    - -

    Source

    - -

    http://www.nhc.noaa.gov/gis/archive_psurge_results.php?id=al18&year=2012&name=Hurricane%20SANDY

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/df.gis_wind_radii.html b/docs/reference/df.gis_wind_radii.html deleted file mode 100644 index ddeaf4a2..00000000 --- a/docs/reference/df.gis_wind_radii.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - -GIS windfield and forecast wind radii for Hurricane Sandy (AL182012) — df.gis_wind_radii • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    GIS windfield and forecast wind radii for Hurricane Sandy (AL182012)

    - -
    - -
    df.gis_wind_radii
    - -

    Format

    - -

    An object of class list of length 2.

    - -

    Source

    - -

    http://www.nhc.noaa.gov/gis/archive_forecast_info_results.php?id=al18&year=2012&name=Hurricane%20SANDY

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/df.gis_wsp.html b/docs/reference/df.gis_wsp.html deleted file mode 100644 index 17fb8f01..00000000 --- a/docs/reference/df.gis_wsp.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - -GIS wind speed probabilities for Hurricane Sandy (AL182012) — df.gis_wsp • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    GIS wind speed probabilities for Hurricane Sandy (AL182012)

    - -
    - -
    df.gis_wsp
    - -

    Format

    - -

    An object of class list of length 3.

    - -

    Source

    - -

    http://www.nhc.noaa.gov/gis/archive_wsp.php

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/discus.html b/docs/reference/discus.html deleted file mode 100644 index 062373a4..00000000 --- a/docs/reference/discus.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - -discus — discus • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Parse storm Discussion products

    - -
    - -
    discus(contents)
    - -

    Arguments

    - - - - - - -
    contents

    Link to a storm's specific discussion product.

    - -

    Value

    - -

    Dataframe

    - -

    Details

    - -

    Given a direct link to a discussion product, parse and return -dataframe of values.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/ep_prblty_stations.html b/docs/reference/ep_prblty_stations.html deleted file mode 100644 index 77ba4657..00000000 --- a/docs/reference/ep_prblty_stations.html +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - -ep_prblty_stations — ep_prblty_stations • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Retrieve list of probability stations based in the eastern -Pacific from the NHC. To be used in tandem with `wndprb` products.

    - -
    - -
    ep_prblty_stations()
    - -

    Details

    - -

    Originally it was believed this data source would be removed by the -National Hurricane Center but it appears to have been updated. Additional -columns have been added, one up front and three in the back. These columns -all contain the same values each and I am unable to find documentation -describing the values.

    -

    Regardless, the data is kept, just in case.

    - -

    Warnings

    - - -

    Calling ep_prblty_stations will generate a warning:

    -

    > "Expected 7 pieces. Missing pieces filled with `NA` in 1 rows [41]."

    -

    Station SALINA CRUZ actually has six columns.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/ep_tracking_chart.html b/docs/reference/ep_tracking_chart.html deleted file mode 100644 index b1657eb6..00000000 --- a/docs/reference/ep_tracking_chart.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - - - -ep_tracking_chart — ep_tracking_chart • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Build tracking chart centered on northeast Pacific Basin.

    - -
    - -
    ep_tracking_chart(...)
    - -

    Arguments

    - - - - - - -
    ...

    Additional parameters for ggplot2

    - -

    Value

    - -

    ggplot2 object centered on northeast Pacific basin.

    - -

    See also

    - - - - -

    Examples

    -
    # NOT RUN {
    -# Build map with white land areas, thin black borders
    -ep_tracking_chart(color = "black", size = 0.1, fill = "white")
    -
    -# 50nm resolution, no states
    -ep_tracking_chart(res = 50, states = FALSE, color = "black", size = 0.1,
    -          fill = "white")
    -
    -# 50nm resolution, coastlines only
    -ep_tracking_chart(countries = FALSE, res = 50, color = "black", size = 0.1,
    -          fill = "white")
    -
    -# Adding and modifying with ggplot functions
    -ep_tracking_chart(color = "black", size = 0.1, fill = "white") +
    -  ggplot2::labs(x = "Lon", y = "Lat",
    -  title = "Base East Pacific Tracking Chart")
    -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/extract_product_contents.html b/docs/reference/extract_product_contents.html deleted file mode 100644 index 9b4d6634..00000000 --- a/docs/reference/extract_product_contents.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - -extract_product_contents — extract_product_contents • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get and parse product contents for each links

    - -
    - -
    extract_product_contents(links, product)
    - -

    Arguments

    - - - - - - - - - - -
    links

    URLs to storm products

    product

    specific product to parse

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/extract_storm_links.html b/docs/reference/extract_storm_links.html deleted file mode 100644 index af1488c3..00000000 --- a/docs/reference/extract_storm_links.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - -extract_storm_links — extract_storm_links • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Extract product links from a storm's archive page

    - -
    - -
    extract_storm_links(links)
    - -

    Arguments

    - - - - - - -
    links

    URLs to a storm's archive page

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/extract_storms.html b/docs/reference/extract_storms.html deleted file mode 100644 index e28741e9..00000000 --- a/docs/reference/extract_storms.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - -extract_storms — extract_storms • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Extract storms for the given basin

    - -
    - -
    extract_storms(basin, contents)
    - -

    Arguments

    - - - - - - - - - - -
    basin

    AL or EP

    contents

    contents of basin archive page

    - -

    Value

    - -

    4xN Dataframe

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/extract_year_archive_link.html b/docs/reference/extract_year_archive_link.html deleted file mode 100644 index 0ba28df6..00000000 --- a/docs/reference/extract_year_archive_link.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - -extract_year_archive_link — extract_year_archive_link • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Extracts the year from the archive link.

    - -
    - -
    extract_year_archive_link(link)
    - -

    Arguments

    - - - - - - -
    link

    URL of archive page

    - -

    Value

    - -

    year 4-digit numeric

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/figures/logo.png b/docs/reference/figures/logo.png deleted file mode 100644 index 65bec986..00000000 Binary files a/docs/reference/figures/logo.png and /dev/null differ diff --git a/docs/reference/filter_discus.html b/docs/reference/filter_discus.html deleted file mode 100644 index d5e6a9c5..00000000 --- a/docs/reference/filter_discus.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - -filter_discus — filter_discus • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Filter out storm discussion links.

    - -
    - -
    filter_discus(links)
    - -

    Arguments

    - - - - - - -
    links

    Vector of URLs retrieved from storm's archive page.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/filter_fstadv.html b/docs/reference/filter_fstadv.html deleted file mode 100644 index dd0dce21..00000000 --- a/docs/reference/filter_fstadv.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - -filter_fstadv — filter_fstadv • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Filter out forecast/advisory links

    - -
    - -
    filter_fstadv(links)
    - -

    Arguments

    - - - - - - -
    links

    Vector of URLs retrieved from storm's archive page.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/filter_orig.html b/docs/reference/filter_orig.html deleted file mode 100644 index e0049628..00000000 --- a/docs/reference/filter_orig.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - -filter_orig — filter_orig • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    For Katrina, 2005, there are two identical discussions; one of - which has 'orig' in the URL. Because this link is not captured above it - will throw an error. This function is an effort to capture it and pass - it through the validation but, at least for this Katrina it is not - necessary. That being said, if there is output for any other storms it - should be reviewed as it is common for the NHC to issue UPDATED statements.

    - -
    - -
    filter_orig(links)
    - -

    Arguments

    - - - - - - -
    links

    Vector of URLs retrieved from storm's archive page.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/filter_posest.html b/docs/reference/filter_posest.html deleted file mode 100644 index 9d5fc1ec..00000000 --- a/docs/reference/filter_posest.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - -filter_posest — filter_posest • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get position estimates

    - -
    - -
    filter_posest(links)
    - -

    Arguments

    - - - - - - -
    links

    Vector of URLs retrieved from storm's archive page.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/filter_prblty.html b/docs/reference/filter_prblty.html deleted file mode 100644 index ac9476d1..00000000 --- a/docs/reference/filter_prblty.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - -filter_prblty — filter_prblty • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get strike probabilities.

    - -
    - -
    filter_prblty(links)
    - -

    Arguments

    - - - - - - -
    links

    Vector of URLs retrieved from storm's archive page.

    - -

    Details

    - -

    Strike probability products were terminated at the end of the 2005 -season, replaced by wind probabilities.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/filter_public.html b/docs/reference/filter_public.html deleted file mode 100644 index 67826b65..00000000 --- a/docs/reference/filter_public.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - -filter_public — filter_public • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get public advisories

    - -
    - -
    filter_public(links)
    - -

    Arguments

    - - - - - - -
    links

    Vector of URLs retrieved from storm's archive page.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/filter_update.html b/docs/reference/filter_update.html deleted file mode 100644 index f4292d3f..00000000 --- a/docs/reference/filter_update.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - -filter_update — filter_update • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get updates

    - -
    - -
    filter_update(links)
    - -

    Arguments

    - - - - - - -
    links

    Vector of URLs retrieved from storm's archive page.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/filter_wndprb.html b/docs/reference/filter_wndprb.html deleted file mode 100644 index 0b7b7cfb..00000000 --- a/docs/reference/filter_wndprb.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - -filter_wndprb — filter_wndprb • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get wind probabilities

    - -
    - -
    filter_wndprb(links)
    - -

    Arguments

    - - - - - - -
    links

    Vector of URLs retrieved from storm's archive page.

    - -

    Details

    - -

    Wind probability products replaced the strike probability products -at the beginning of the 2006 season.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/fstadv.html b/docs/reference/fstadv.html deleted file mode 100644 index a8d20b8a..00000000 --- a/docs/reference/fstadv.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - -fstadv — fstadv • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Extrapolate data from FORECAST/ADVISORY products.

    - -
    - -
    fstadv(contents)
    - -

    Arguments

    - - - - - - -
    contents

    URL of a specific FORECAST/ADVISORY product

    - -

    Details

    - -

    Given a direct link to a forecast/advisory product, parse and -return dataframe of values.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/fstadv_eye.html b/docs/reference/fstadv_eye.html deleted file mode 100644 index 2337851b..00000000 --- a/docs/reference/fstadv_eye.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - -fstadv_eye — fstadv_eye • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get eye diameter, if available

    - -
    - -
    fstadv_eye(contents)
    - -

    Arguments

    - - - - - - -
    contents

    text contents of FORECAST/ADVISORY

    - -

    Value

    - -

    numeric

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/fstadv_forecasts.html b/docs/reference/fstadv_forecasts.html deleted file mode 100644 index 851d4ee2..00000000 --- a/docs/reference/fstadv_forecasts.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - -fstadv_fcst — fstadv_forecasts • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Retrieve forecast data from FORECAST/ADVISORY products. Loads - into respective dataframes (df_forecasts, df_forecast_winds)

    - -
    - -
    fstadv_forecasts(content, key, adv, adv_date)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - -
    content

    text content of FORECAST/ADVISORY

    key

    Storm ID

    adv

    Advisory Number

    adv_date

    Date value of forecast/advisory product.

    - -

    Value

    - -

    boolean

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/fstadv_fwd_mvmt.html b/docs/reference/fstadv_fwd_mvmt.html deleted file mode 100644 index f08088ef..00000000 --- a/docs/reference/fstadv_fwd_mvmt.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - -fstadv_fwd_mvmt — fstadv_fwd_mvmt • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get forward movement direction and speed

    - -
    - -
    fstadv_fwd_mvmt(contents, what = NULL)
    - -

    Arguments

    - - - - - - - - - - -
    contents

    text contents of FORECAST/ADVISORY

    what

    is being retrieved

      -
    • fwd_dir integer azimuth direction of movement (0 - 360)

    • -
    • fwd_speed integer speed of movement in kts

    • -
    - -

    Value

    - -

    numeric

    - -

    Details

    - -

    If STATIONARY should return NA

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/fstadv_lat_lon.html b/docs/reference/fstadv_lat_lon.html deleted file mode 100644 index b1246197..00000000 --- a/docs/reference/fstadv_lat_lon.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - -fstadv_lat_lon — fstadv_lat_lon • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Returns numeric for latitude or longitude; negative if in - southern or eastern hemisphere

    - -
    - -
    fstadv_lat_lon(contents)
    - -

    Arguments

    - - - - - - -
    contents

    text contents of FORECAST/ADVISORY

    - -

    Value

    - -

    numeric

    - -

    Details

    - -

    Helper function to take character latitude or longitude and, -depending on the value of hemisphere return a positive or negative numeric, -or NA if not found.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/fstadv_pos_accuracy.html b/docs/reference/fstadv_pos_accuracy.html deleted file mode 100644 index c5786366..00000000 --- a/docs/reference/fstadv_pos_accuracy.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - -fstadv_pos_accuracy() — fstadv_pos_accuracy • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get position accuracy

    - -
    - -
    fstadv_pos_accuracy(contents)
    - -

    Arguments

    - - - - - - -
    contents

    text contents of FORECAST/ADVISORY

    - -

    Value

    - -

    numeric

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/fstadv_pressure.html b/docs/reference/fstadv_pressure.html deleted file mode 100644 index 4cf813d4..00000000 --- a/docs/reference/fstadv_pressure.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - -fstadv_pressure — fstadv_pressure • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Return current minimum central pressure of storm in - millibars (mb)

    - -
    - -
    fstadv_pressure(contents)
    - -

    Arguments

    - - - - - - -
    contents

    text contents of FORECAST/ADVISORY product

    - -

    Value

    - -

    numeric

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/fstadv_prev_pos.html b/docs/reference/fstadv_prev_pos.html deleted file mode 100644 index b5ad7d18..00000000 --- a/docs/reference/fstadv_prev_pos.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - -fstadv_prev_pos — fstadv_prev_pos • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get storm's previous position

    - -
    - -
    fstadv_prev_pos(contents, adv_date)
    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/fstadv_seas.html b/docs/reference/fstadv_seas.html deleted file mode 100644 index d7afc1f2..00000000 --- a/docs/reference/fstadv_seas.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - -fstadv_seas — fstadv_seas • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    There is only one line of sea data, 12FT seas in each quadrant. -So this should go easier than the wind fields

    - -
    - -
    fstadv_seas(content)
    - -

    Arguments

    - - - - - - -
    content

    text of product

    - -

    Value

    - -

    boolean

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/fstadv_wind_radius.html b/docs/reference/fstadv_wind_radius.html deleted file mode 100644 index 87e14200..00000000 --- a/docs/reference/fstadv_wind_radius.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - -fstadv_wind_radius — fstadv_wind_radius • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Parse wind radius data from product, if exists. This is somewhat -tricky as the wind fields are 64KT, 50KT and 34KT and are listed in -descending order. So the first line will not always be 64KT, 50KT or even -34KT depending on strength of storm. What I do here is just extract the -entire blob and work through it. I'll continue to look for ways to improve -it.

    -

    Complimentary to fstadv_get_wind_radius

    - -
    - -
    fstadv_wind_radius(content)
    - -

    Arguments

    - - - - - - -
    contents

    text of product

    - -

    Value

    - -

    dataframe

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/fstadv_winds_gusts.html b/docs/reference/fstadv_winds_gusts.html deleted file mode 100644 index 2d3fe90c..00000000 --- a/docs/reference/fstadv_winds_gusts.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - -fstadv_winds_gusts — fstadv_winds_gusts • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get winds or gusts in knots (KT)

    - -
    - -
    fstadv_winds_gusts(contents)
    - -

    Arguments

    - - - - - - -
    contents

    text contents of FORECAST/ADVISORY product

    - -

    Value

    - -

    numeric

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_discus.html b/docs/reference/get_discus.html deleted file mode 100644 index b55f995e..00000000 --- a/docs/reference/get_discus.html +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - - -get_discus — get_discus • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Return dataframe of discussion data.

    -
    Status

    Classification of storm, e.g., Tropical Storm, Hurricane, - etc.

    -
    Name

    Name of storm

    -
    Adv

    Advisory Number

    -
    Date

    Date of advisory issuance

    -
    Key

    ID of cyclone

    -
    Contents

    Text content of product

    -
    - -
    - -
    get_discus(links)
    - -

    Arguments

    - - - - - - -
    links

    URL to storm's archive page.

    - -

    See also

    - - - - -

    Examples

    -
    # NOT RUN {
    -# Return dataframe of storm discussions for Tropical Storm Alex (AL011998)
    -get_discus("http://www.nhc.noaa.gov/archive/1998/1998ALEXadv.html")
    -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_fstadv.html b/docs/reference/get_fstadv.html deleted file mode 100644 index 150db991..00000000 --- a/docs/reference/get_fstadv.html +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - -get_fstadv — get_fstadv • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Return dataframe of forecast/advisory data.

    - -
    - -
    get_fstadv(links)
    - -

    Arguments

    - - - - - - -
    links

    URL to storms' archive page.

    - -

    Details

    - -

    Returns a wide dataframe of most the data available in a cyclones -forecast/advisory product (watches and warnings are not included at this -time).

    -

    Overall structure of the dataframe is listed below. Note the following -clarifications:

    -
      -
    1. The value of `n` in `Hr{n}` variables is the forecast period. - Up to 2002, forecast periods are 12, 24, 36, 48 and 72 hours. After - 2002, forecast periods were extended to 96 and 120 hours. Not all - forecast periods will be available for every cyclone advisory (e.g., - if it is dissipating or expected to dissipate.)

    2. -
    3. Wind radius data is not included 96 and 120 hour forecast periods.

    4. -
    5. Forecast dates are not truly 12, 24, ..., 120 hours from the - date/time of the advisory. The NHC issues two positions in these - products; one for current and one for three hours prior. It is the - latter position the forecast date/times are based.

    6. -
    -
    -
    Status

    Classification of cyclone

    -
    Name

    Name of cyclone

    -
    Adv

    Advisory number

    -
    Date

    Date and time of advisory

    -
    Key

    Unique identifier of cyclone

    -
    Lat

    Latitude of cyclone center

    -
    Lon

    Longitude of cyclone center

    -
    Wind

    Maximum sustained one-minute winds in knots

    -
    Gust

    Maximum sustained one-minute gusts in knots

    -
    Pressure

    Minimum central pressure in millibars

    -
    PosAcc

    Position accuracy of cyclone in nautical miles

    -
    FwdDir

    Compass angle of forward motion

    -
    FwdSpeed

    Forward speed in miles per hour

    -
    Eye

    Size of eye in nautical miles

    -
    NE64

    Radius of >=64kt winds in northeast quadrant

    -
    SE64

    Radius of >=64kt winds in southeast quadrant

    -
    SW64

    Radius of >=64kt winds in southwest quadrant

    -
    NW64

    Radius of >=64kt winds in northwest quadrant

    -
    NE50

    Radius of >=50kt winds in northeast quadrant

    -
    SE50

    Radius of >=50kt winds in southeast quadrant

    -
    SW50

    Radius of >=50kt winds in southwest quadrant

    -
    NW50

    Radius of >=50kt winds in northwest quadrant

    -
    NE34

    Radius of >=34kt winds in northwest quadrant

    -
    SE34

    Radius of >=34kt winds in southeast quadrant

    -
    SW34

    Radius of >=34kt winds in southwest quadrant

    -
    NW34

    Radius of >=34kt winds in northwest quadrant

    -
    Hr{n}FcstDate

    Forecast valid date

    -
    Hr{n}Lat

    Forecast latitude in `n` hours

    -
    Hr{n}Lon

    Forecast longitude in `n` hours

    -
    Hr{n}Wind

    Forecast maximum wind in `n` hours

    -
    Hr{n}Gust

    Forecast maximum gust in `n` hours

    -
    Hr{n}NE64

    Forecast wind radius in `n` hours

    -
    Hr{n}SE64

    Forecast wind radius in `n` hours

    -
    Hr{n}SW64

    Forecast wind radius in `n` hours

    -
    Hr{n}NW64

    Forecast wind radius in `n` hours

    -
    Hr{n}NE50

    Forecast wind radius in `n` hours

    -
    Hr{n}SE50

    Forecast wind radius in `n` hours

    -
    Hr{n}SW50

    Forecast wind radius in `n` hours

    -
    Hr{n}NW50

    Forecast wind radius in `n` hours

    -
    Hr{n}NE34

    Forecast wind radius in `n` hours

    -
    Hr{n}SE34

    Forecast wind radius in `n` hours

    -
    Hr{n}SW34

    Forecast wind radius in `n` hours

    -
    Hr{n}NW34

    Forecast wind radius in `n` hours

    -
    SeasNE

    Radius of 12ft seas in northeast quadrant

    -
    SeasSE

    Radius of 12ft seas in southeast quadrant

    -
    SeasSW

    Radius of 12ft seas in southwest quadrant

    -
    SeasNW

    Radius of 12ft seas in northwest quadrant

    -
    - -

    See also

    - - - - -

    Examples

    -
    # NOT RUN {
    -# Return dataframe of forecast/advisories for Tropical Storm Alex (AL011998)
    -get_fstadv("http://www.nhc.noaa.gov/archive/1998/1998ALEXadv.html")
    -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_ftp_dirs.html b/docs/reference/get_ftp_dirs.html deleted file mode 100644 index dd03bd33..00000000 --- a/docs/reference/get_ftp_dirs.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - -get_ftp_dirs() — get_ftp_dirs • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get a list of the FTP directors in /atcf/archive

    - -
    - -
    get_ftp_dirs(x)
    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_ftp_storm_data.html b/docs/reference/get_ftp_storm_data.html deleted file mode 100644 index 3646aeaa..00000000 --- a/docs/reference/get_ftp_storm_data.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - -get_ftp_storm_data — get_ftp_storm_data • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Retrieve text products from the National Hurricane Center's FTP - server. Not all products may exist for certain storms.

    - -
    - -
    get_ftp_storm_data(stormid, products = c("discus", "fstadv", "posest",
    -  "public", "prblty", "update", "wndprb"))
    - -

    Arguments

    - - - - - - - - - - -
    stormid

    A six-character alphanumeric string formatted as AABBCCCC -where

    -
    AA

    The basin of the storm; AL or EP

    -
    BB

    Storm number for the year as decimal number - (e.g., 01, 02, ..., 10, ...)

    -
    CCCC

    Year with century)

    -
    products

    Products to retrieve; discus, fstadv, posest, public, -prblty, update, and windprb.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_nhc_ftp_link.html b/docs/reference/get_nhc_ftp_link.html deleted file mode 100644 index 94fa722c..00000000 --- a/docs/reference/get_nhc_ftp_link.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - - - -get_nhc_ftp_link — get_nhc_ftp_link • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Return root of NHC FTP server

    - -
    - -
    get_nhc_ftp_link(withTrailingSlash = TRUE)
    - -

    Arguments

    - - - - - - -
    withTrailingSlash

    True, by default. False returns URL without -trailing slash.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_nhc_link.html b/docs/reference/get_nhc_link.html deleted file mode 100644 index fb158da3..00000000 --- a/docs/reference/get_nhc_link.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - -get_nhc_link — get_nhc_link • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Return root link of NHC archive pages.

    - -
    - -
    get_nhc_link(withTrailingSlash = TRUE, protocol = "https")
    - -

    Arguments

    - - - - - - - - - - -
    withTrailingSlash

    True, by default. False returns URL without -trailing slash.

    protocol

    https or http

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_posest.html b/docs/reference/get_posest.html deleted file mode 100644 index 1f5dfe6d..00000000 --- a/docs/reference/get_posest.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - -get_posest — get_posest • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Return dataframe of position estimate data.

    - -
    - -
    get_posest(links)
    - -

    Arguments

    - - - - - - -
    links

    URL to storm's archive page.

    - -

    Details

    - -

    This product was discontinued after the 2013 hurricane season and is -now included in the Tropical Cyclone Update product (update).

    -
    Status

    Classification of storm, e.g., Tropical Storm, Hurricane, - etc.

    -
    Name

    Name of storm

    -
    Date

    Date of advisory issuance

    -
    Contents

    Text content of product

    -
    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_prblty.html b/docs/reference/get_prblty.html deleted file mode 100644 index d2b850dc..00000000 --- a/docs/reference/get_prblty.html +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - -get_prblty — get_prblty • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Strike probabilities; the chances of the center of a cyclone -passing within 65 nautical miles of a location.

    -
    Status

    Classification of storm, e.g., Tropical Storm, Hurricane, - etc.

    -
    Name

    Name of storm

    -
    Adv

    Advisory Number

    -
    Date

    Date of advisory issuance

    -
    Location

    Location for which the probability statistics rely

    -
    A

    Probability of a strike within the next 12 hours

    -
    B

    Probability of a strike between 12 and 24 hours

    -
    C

    Probability of a strike between 24 and 36 hours

    -
    D

    Probability of a strike between 36 and 48 hours

    -
    E

    Probability of a strike between 48 and 72 hours

    -
    - -
    - -
    get_prblty(links)
    - -

    Arguments

    - - - - - - -
    links

    URL to storm's archive page.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_product.html b/docs/reference/get_product.html deleted file mode 100644 index 8d826c05..00000000 --- a/docs/reference/get_product.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - -get_product — get_product • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    This funtion acts as a hub for the individual product extraction - functions. Given the product and links, it will begin the scraping - process and return a dataset for that product.

    - -
    - -
    get_product(links, product)
    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_public.html b/docs/reference/get_public.html deleted file mode 100644 index e0164482..00000000 --- a/docs/reference/get_public.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - - - -get_public — get_public • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Return dataframe of public advisory data.

    -
    Status

    Classification of storm, e.g., Tropical Storm, Hurricane, - etc.

    -
    Name

    Name of storm

    -
    Adv

    Advisory Number

    -
    Date

    Date of advisory issuance

    -
    Key

    Unique ID of the cyclone

    -
    Contents

    Text content of product

    -
    - -
    - -
    get_public(links)
    - -

    Arguments

    - - - - - - -
    links

    URL to storm's archive page.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_storm_data.html b/docs/reference/get_storm_data.html deleted file mode 100644 index 5e2e5fac..00000000 --- a/docs/reference/get_storm_data.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - - - -get_storm_data — get_storm_data • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Retrieve data from products.

    - -
    - -
    get_storm_data(links, products = c("discus", "fstadv", "posest",
    -  "public", "prblty", "update", "wndprb"))
    - -

    Arguments

    - - - - - - - - - - -
    links

    to storm's archive page.

    products

    Products to retrieve; discus, fstadv, posest, public, -prblty, update, and windprb.

    - -

    Value

    - -

    list of dataframes for each of the products.

    - -

    Details

    - -

    get_storm_data is a wrapper function to make it more - convenient to access the various storm products.

    -

    Types of products:

    -
    discus

    Storm Discussions. This is technical information on the - cyclone such as satellite presentation, forecast model evaluation, etc.

    -
    fstadv

    Forecast/Advisory. These products contain the meat of an - advisory package. Current storm information is available as well as - structural design and forecast data.

    -
    posest

    Position Estimate. Issued generally when a storm is - threatening; provides a brief update on location and winds.

    -
    public

    Public Advisory. Issued for public knowledge; more often for - Atlantic than East Pacific storms. Contains general information.

    -
    prblty

    Strike Probability. Discontinued after the 2005 hurricane - season, strike probabilities list the chances of x-force winds in a - particular city.

    -
    update

    Cyclone Update. Generally issued when a significant change - occurs in the cyclone.

    -
    windprb

    Wind Probability. Replace strike probabilities beginning in - the 2006 season. Nearly identical.

    -
    -

    Progress bars are displayed by default. These can be turned off by setting -the dplyr.show_progress to FALSE. Additionally, you can display messages for -each advisory being worked by setting the rrricanes.working_msg to TRUE.

    - -

    See also

    - - - - -

    Examples

    -
    # NOT RUN {
    -## Get public advisories for first storm of 2016 Atlantic season.
    -get_storms(year = 2016, basin = "AL") %>%
    -  slice(1) %>%
    -  .$Link %>%
    -  get_storm_data(products = "public")
    -## Get public advisories and storm discussions for first storm of 2017 Atlantic season.
    -get_storms(year = 2017, basin = "AL") %>%
    -  slice(1) %>%
    -  .$Link %>%
    -  get_storm_data(products = c("discus", "public"))
    -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_storm_list.html b/docs/reference/get_storm_list.html deleted file mode 100644 index e78a89a9..00000000 --- a/docs/reference/get_storm_list.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - -get_storm_list — get_storm_list • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get storm list

    - -
    - -
    get_storm_list()
    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_storms.html b/docs/reference/get_storms.html deleted file mode 100644 index a50575f6..00000000 --- a/docs/reference/get_storms.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - - -get_storms — get_storms • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Returns storms and product link.

    - -
    - -
    get_storms(years = format(Sys.Date(), "%Y"), basins = c("AL", "EP"))
    - -

    Arguments

    - - - - - - - - - - -
    years

    numeric or vector, four digits (%Y format)

    basins

    One or both of c("AL", "EP")

    - -

    Format

    - -

    A 4xN dataframe

    -
    Year

    Numeric, four-digit year of the storm

    -
    Name

    Character, name of storm mixed-case

    -
    Basin

    AL (Atlantic) or EP (East Pacific)

    -
    Link

    URL to storms' product pages

    -
    -

    To disable the progress bar set option dplyr.show_progress to FALSE.

    - -

    Source

    - -

    http://www.nhc.noaa.gov/archive/2016/

    - -

    Value

    - -

    Dataframe of storms.

    - -

    Details

    - -

    By default returns all storms for the current year. If no storms -have developed will return an empty dataframe.

    - - -

    Examples

    -
    # Default. Get all storms, both basins, for last year. -
    # NOT RUN { -storms <- get_storms(year = 2016, basin = c("AL", "EP")) - -# Get storms for two different years -storms.2010 <- get_storms(c(2010, 2015)) - -# Get storms for two consecutive years, Atlantic basin only -storms.al.2005 <- get_storms(2005:2007, basin = "AL") -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_update.html b/docs/reference/get_update.html deleted file mode 100644 index f6ac22d4..00000000 --- a/docs/reference/get_update.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - -get_update — get_update • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Return dataframe of cyclone update data.

    -
    Status

    Classification of storm, e.g., Tropical Storm, Hurricane, - etc.

    -
    Name

    Name of storm

    -
    Date

    Date of advisory issuance

    -
    Key

    Unique ID of cyclone

    -
    Contents

    Text content of product

    -
    - -
    - -
    get_update(links)
    - -

    Arguments

    - - - - - - -
    links

    URL to storm's archive page.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_url_contents.html b/docs/reference/get_url_contents.html deleted file mode 100644 index df0d3ec9..00000000 --- a/docs/reference/get_url_contents.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - -get_url_contents — get_url_contents • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get contents from URL

    - -
    - -
    get_url_contents(links)
    - -

    Arguments

    - - - - - - -
    link

    URL to download

    - -

    Details

    - -

    This function primarily is reserved for extracting the contents of -the individual products \(thought it can be used in other instances\). Often, -there are timeout issues. This is an attempt to try to work around that.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/get_wndprb.html b/docs/reference/get_wndprb.html deleted file mode 100644 index e570e9e1..00000000 --- a/docs/reference/get_wndprb.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - -get_wndprb — get_wndprb • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Return dataframe of wind speed probability data.

    - -
    - -
    get_wndprb(links)
    - -

    Arguments

    - - - - - - -
    links

    URL to storm's archive page.

    - -

    Source

    - -

    http://www.nhc.noaa.gov/about/pdf/About_Windspeed_Probabilities.pdf

    - -

    Details

    - -

    Wind Speed Probability product replaced Strike Probabilities product - after the 2005 hurricane season. These products may not be issued for - every advisory/cyclone.

    -
    -
    Status

    Classification of storm, e.g., Tropical Storm, Hurricane, - etc.

    -
    Name

    Name of storm

    -
    Adv

    Advisory Number

    -
    Date

    Date of advisory issuance

    -
    Wind

    Minimum wind speed for which probabilities reference

    -
    Wind12

    Probability of sustained `Wind` within 12 hours

    -
    Wind24

    Probability of sustained `Wind` within 24 hours

    -
    Wind24Cum

    Cumulative probability through 24 hours

    -
    Wind36

    Probability of sustained `Wind` within 36 hours

    -
    Wind36Cum

    Cumulative probability through 36 hours

    -
    Wind48

    Probability of sustained `Wind` within 48 hours

    -
    Wind48Cum

    Cumulative probability through 48 hours

    -
    Wind72

    Probability of sustained `Wind` within 72 hours

    -
    Wind72Cum

    Cumulative probability through 72 hours

    -
    Wind96

    Probability of sustained `Wind` within 96 hours

    -
    Wind96Cum

    Cumulative probability through 96 hours

    -
    Wind120

    Probability of sustained `Wind` within 120 hours

    -
    Wind120Cum

    Cumulative probability through 120 hours

    -
    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/gis_advisory.html b/docs/reference/gis_advisory.html deleted file mode 100644 index e6a9b4b9..00000000 --- a/docs/reference/gis_advisory.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - -gis_advisory — gis_advisory • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Advisory Forecast Track, Cone of Uncertainty, and - Watches/Warnings

    - -
    - -
    gis_advisory(key, advisory = as.character())
    - -

    Arguments

    - - - - - - - - - - -
    key

    Key of storm (i.e., AL012008, EP092015)

    advisory

    Advisory number. If NULL, all advisories are returned. -Intermediate advisories are acceptable.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/gis_breakpoints.html b/docs/reference/gis_breakpoints.html deleted file mode 100644 index 26a27e2b..00000000 --- a/docs/reference/gis_breakpoints.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - -gis_breakpoints — gis_breakpoints • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Return link to breakpoints shapefile by year

    - -
    - -
    gis_breakpoints()
    - -

    Details

    - -

    Coastal areas placed under tropical storm and hurricane watches and - warnings are identified through the use of "breakpoints." A tropical - cyclone breakpoint is defined as an agreed upon coastal location that can - be chosen as one of two specific end points or designated places between - which a tropical storm/hurricane watch/warning is in effect. The U.S. - National Weather Service designates the locations along the U.S. East, - Gulf, and California coasts, Puerto Rico, and Hawaii. These points are - listed in NWS Directive 10-605 (PDF). Individual countries across the - Caribbean, Central America, and South America provide coastal locations - for their areas of responsibility to the U.S. National Weather Service for - the National Hurricane Center's use in tropical cyclone advisories when - watches/warnings are issued by international partners. The National - Hurricane Center maintains a list of pre-arranged breakpoints for the U.S. - Atlantic and Gulf coasts, Mexico, Cuba and the Bahamas. Other sites are - unofficial and sites not on the list can be selected if conditions warrant.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/gis_download.html b/docs/reference/gis_download.html deleted file mode 100644 index 61e85313..00000000 --- a/docs/reference/gis_download.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - -gis_download — gis_download • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Get GIS data for storm.

    - -
    - -
    gis_download(url, ...)
    - -

    Arguments

    - - - - - - - - - - -
    url

    link to GIS dataset to download.

    ...

    additional parameters for rgdal::readOGR

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/gis_latest.html b/docs/reference/gis_latest.html deleted file mode 100644 index 70a7c0bd..00000000 --- a/docs/reference/gis_latest.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - -gis_latest — gis_latest • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Latest GIS datasets for active cyclones

    - -
    - -
    gis_latest(basins = c("AL", "EP"), ...)
    - -

    Arguments

    - - - - - - - - - - -
    basins

    AL and/or EP.

    ...

    additional parameters for rgdal::readOGR

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/gis_outlook.html b/docs/reference/gis_outlook.html deleted file mode 100644 index 0d671982..00000000 --- a/docs/reference/gis_outlook.html +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - - - -gis_outlook — gis_outlook • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Tropical Weather Outlook

    - -
    - -
    gis_outlook()
    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/gis_prob_storm_surge.html b/docs/reference/gis_prob_storm_surge.html deleted file mode 100644 index 9288b77c..00000000 --- a/docs/reference/gis_prob_storm_surge.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - - - - - -gis_prob_storm_surge — gis_prob_storm_surge • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Probabilistic Storm Surge

    - -
    - -
    gis_prob_storm_surge(key, products, datetime = NULL)
    - -

    Arguments

    - - - - - - - - - - - - - - -
    key

    Key of storm (i.e., AL012008, EP092015)

    products

    list of products and associated n values; psurge (0:20) or -esurge (10, 20, 30, 40, 50).

    datetime

    Datetime in %Y%m%d%H format.

    - -

    Details

    - -

    Probabilistic Storm Surge Forecasts

    - -

    Products

    - - -
    -
    esurge

    The Tropical Cyclone Storm Surge Exceedances (P-Surge 2.5) - data shows the probability, in percent, of a specified storm surge, - including tides, exceeding the specified height, in feet, during the - forecast period indicated. The 10 percent exceedance height, for example, - is the storm surge height, including tides, above ground level (AGL) such - that there is a 10 percent chance of exceeding it. The product is based - upon an ensemble of Sea, Lake,and Overland Surge from Hurricanes (SLOSH) - model runs using the National Hurricane Center (NHC) official advisory - and accounts for track, size, and intensity errors based on historical - errors and astronomical tide. Valid values are 10, 20, 30, 40 or 50.

    -
    psurge

    The Tropical Cyclone Storm Surge Probabilities (P-Surge 2.5) - data shows the probability, in percent, of a specified storm surge - occurring during the forecast period indicated. The product is based upon - an ensemble of Sea, Lake, and Overland Surge from Hurricanes (SLOSH) - model runs using the National Hurricane Center(NHC) official advisory - and accounts for track, size, and intensity errors based on historical - errors and astronomical tide. Valid values are 0:20.

    -
    - -

    See also

    - - - - -

    Examples

    -
    # NOT RUN {
    -# Return the last psurge0 product for storm AL092016
    -gis_prob_storm_surge("AL092016", products = list("psurge" = 0))
    -
    -# Return the psurge0 and esurge10 products for storm AL092016
    -gis_prob_storm_surge("AL092016", products = list("psurge" = 0, "esurge" = 10))
    -
    -# Return all psurge0 products for Sep 2, 2016, storm AL092016
    -gis_prob_storm_surge("AL092016", products = list("psurge" = 0),
    -           datetime = "20160902")
    -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/gis_storm_surge_flood.html b/docs/reference/gis_storm_surge_flood.html deleted file mode 100644 index 91523dec..00000000 --- a/docs/reference/gis_storm_surge_flood.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - -gis_storm_surge_flood — gis_storm_surge_flood • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Potential Storm Surge Flooding (Inundation)

    - -
    - -
    gis_storm_surge_flood(key, advisory = as.numeric(),
    -  products = c("inundation", "tidalmask"))
    - -

    Arguments

    - - - - - - - - - - - - - - -
    key

    Key of storm (i.e., AL012008, EP092015)

    advisory

    Advisory number.

    products

    indundation or tidalmask

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/gis_windfield.html b/docs/reference/gis_windfield.html deleted file mode 100644 index 11971f63..00000000 --- a/docs/reference/gis_windfield.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - -gis_windfield — gis_windfield • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Advisory Wind Field and Forecast Wind Radii

    - -
    - -
    gis_windfield(key, advisory = as.character())
    - -

    Arguments

    - - - - - - - - - - -
    key

    Key of storm (i.e., AL012008, EP092015)

    advisory

    Advisory number. If NULL, all advisories are returned. -Intermediate advisories are acceptable.

    - -

    Details

    - -

    Tropical Cyclone Advisory Wind Field - http://www.nhc.noaa.gov/gis/archive_forecast_info_results.php?id=al14&year=2016 - http://www.nhc.noaa.gov/gis/forecast/archive/ -Example file name: al012017_fcst_001.zip -[basin]2[year_num]2[year]4_fcst_[advisory]3.zip -Many storms do not appear to have this data; especially earlier.

    -

    Not all advisories will be available for storms. For example, -Hurricane Matthew (AL142016) -is missing several advisories.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/gis_wsp.html b/docs/reference/gis_wsp.html deleted file mode 100644 index e1bfe0e2..00000000 --- a/docs/reference/gis_wsp.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - - - -gis_wsp — gis_wsp • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Wind Speed Probabilities

    - -
    - -
    gis_wsp(datetime, res = c(5, 0.5, 0.1))
    - -

    Arguments

    - - - - - - - - - - -
    datetime

    Datetime in %Y%m%d%H format. %m, %d and %H are -optional but will return more datasets.

    res

    Resolution as a numeric vector; 5, 0.5, 0.1.

    - -

    Details

    - -

    Probability winds affecting an area within a forecast period. -Datasets contain windfields for 34kt, 50kt and 64kt. Resolution is at 5km, -0.5 degrees and 0.1 degrees. Not all resolutions may be available for all -storms. Not all windfields will be available for all advisories.

    - -

    See also

    - - - - -

    Examples

    -
    # NOT RUN {
    -# Return datasets for January 1, 2016 with resolution of 0.5 degrees
    -gis_wsp("20160101", res = 0.5)
    -
    -# Return wsp of 0.1 and 0.5 degree resolution, July, 2015
    -gis_wsp("201507", res = c(0.5, 0.1))
    -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/index.html b/docs/reference/index.html deleted file mode 100644 index 6672daa4..00000000 --- a/docs/reference/index.html +++ /dev/null @@ -1,526 +0,0 @@ - - - - - - - - -Function reference • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    About `rrricanes`

    -

    -
    -

    rrricanes

    -

    rrricanes

    -

    Getting Storm Data

    -

    Gather current and archived storm data.

    -
    -

    get_discus()

    -

    get_discus

    -

    get_fstadv()

    -

    get_fstadv

    -

    get_ftp_storm_data()

    -

    get_ftp_storm_data

    -

    get_posest()

    -

    get_posest

    -

    get_prblty()

    -

    get_prblty

    -

    get_public()

    -

    get_public

    -

    get_storm_data()

    -

    get_storm_data

    -

    get_storm_list()

    -

    get_storm_list

    -

    get_storms()

    -

    get_storms

    -

    get_update()

    -

    get_update

    -

    get_wndprb()

    -

    get_wndprb

    -

    Daily Discussions

    -

    Daily statements issued by the National Hurricane Center on current conditions.

    -
    -

    twoal()

    -

    twoal

    -

    twoep()

    -

    twoep

    -

    Tracking charts

    -

    Helper functions to plot storm data through ggplot2.

    -
    -

    al_tracking_chart()

    -

    al_tracking_chart

    -

    ep_tracking_chart()

    -

    ep_tracking_chart

    -

    tracking_chart()

    -

    tracking_chart

    -

    GIS Data

    -

    Gathering GIS data from the National Hurricane Center.

    -
    -

    gis_advisory()

    -

    gis_advisory

    -

    gis_breakpoints()

    -

    gis_breakpoints

    -

    gis_download()

    -

    gis_download

    -

    gis_latest()

    -

    gis_latest

    -

    gis_outlook()

    -

    gis_outlook

    -

    gis_prob_storm_surge()

    -

    gis_prob_storm_surge

    -

    gis_storm_surge_flood()

    -

    gis_storm_surge_flood

    -

    gis_windfield()

    -

    gis_windfield

    -

    gis_wsp()

    -

    gis_wsp

    -

    shp_to_df()

    -

    shp_to_df

    -

    Helpers

    -

    Helper functions. Please note al_prblty_stations and cp_prblty_stations may be deprecated soon.

    -
    -

    al_prblty_stations()

    -

    al_prblty_stations

    -

    cp_prblty_stations()

    -

    cp_prblty_stations

    -

    ep_prblty_stations()

    -

    ep_prblty_stations

    -

    knots_to_mph()

    -

    knots_to_mph

    -

    mb_to_in()

    -

    mb_to_in

    -

    nm_to_sm()

    -

    nm_to_sm

    -

    saffir()

    -

    saffir

    -

    status_abbr_to_str()

    -

    status_abbr_to_str

    -

    tidy_adv() tidy_fstadv()

    -

    tidy_adv

    -

    tidy_fcst()

    -

    tidy_fcst

    -

    tidy_fcst_wr()

    -

    tidy_fcst_wr

    -

    tidy_wr()

    -

    tidy_wr

    -

    Datasets

    -

    Sample datasets included in this package.

    -
    -

    df.al_12_2005_prblty

    -

    Strike probabilities for Hurricane Katrina (AL122005)

    -

    df.al_18_2012_fstadv

    -

    Forecast/Advisory for Hurricane Sandy (AL182012)

    -

    df.al_18_2012_wndprb

    -

    Wind speed probabilities for Hurricane Sandy (AL182012)

    -

    df.al_18_2012

    -

    Forecast/Advisory and Wind Speed Probabilities for Hurricane Sandy (AL182012)

    -

    df.al_2012

    -

    Atlantic cyclones for 2012

    -

    df.gis_adv

    -

    GIS advisory dataset for Hurricane Sandy Adv 18

    -

    df.gis_storm_surge

    -

    GIS storm surge shapefile dataset for Hurricane Sandy (AL182012)

    -

    df.gis_wind_radii

    -

    GIS windfield and forecast wind radii for Hurricane Sandy (AL182012)

    -

    df.gis_wsp

    -

    GIS wind speed probabilities for Hurricane Sandy (AL182012)

    -
    - - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/knots_to_mph.html b/docs/reference/knots_to_mph.html deleted file mode 100644 index 679220e2..00000000 --- a/docs/reference/knots_to_mph.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - -knots_to_mph — knots_to_mph • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    convert knots (kt) to miles per hour (mph)

    - -
    - -
    knots_to_mph(x)
    - -

    Arguments

    - - - - - - -
    x

    wind speed in knots

    - -

    Value

    - -

    x in miles per hour

    - - -

    Examples

    -
    knots_to_mph(65)
    #> [1] 74.80066
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/mb_to_in.html b/docs/reference/mb_to_in.html deleted file mode 100644 index 7ba3b7c3..00000000 --- a/docs/reference/mb_to_in.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - -mb_to_in — mb_to_in • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    convert millibars (mb) to inches of mercury (in)

    - -
    - -
    mb_to_in(x)
    - -

    Arguments

    - - - - - - -
    x

    barometric pressure in mb

    - -

    Value

    - -

    x in inches

    - - -

    Examples

    -
    mb_to_in(999)
    #> [1] 29.50045
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/month_str_to_num.html b/docs/reference/month_str_to_num.html deleted file mode 100644 index 415e826b..00000000 --- a/docs/reference/month_str_to_num.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - -month_str_to_num — month_str_to_num • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Convert three-character month abbreviation to integer

    - -
    - -
    month_str_to_num(m)
    - -

    Arguments

    - - - - - - -
    m

    Month abbreviated (SEP, OCT, etc.)

    - -

    Value

    - -

    numeric 1-12

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/nm_to_sm.html b/docs/reference/nm_to_sm.html deleted file mode 100644 index 351a3594..00000000 --- a/docs/reference/nm_to_sm.html +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - -nm_to_sm — nm_to_sm • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Convert nautical miles to survey miles

    - -
    - -
    nm_to_sm(x)
    - -

    Arguments

    - - - - - - -
    x

    Nautical miles

    - - -

    Examples

    -
    nm_to_sm(c(50, 100, 150))
    #> [1] 57.539 115.078 172.617
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/parse_stations.html b/docs/reference/parse_stations.html deleted file mode 100644 index e0f8be7e..00000000 --- a/docs/reference/parse_stations.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - -parse_stations — parse_stations • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Parse probability station listings for each basin.

    - -
    - -
    parse_stations(x)
    - -

    Arguments

    - - - - - - -
    x

    URL of station list

    - -

    Details

    - -

    At the moment, documentation on the format is unavailable. The -format changed during the 2017/2018 offseason and now includes a -numeric first column and numeric fifth, sixth and seventh column. All -values are identical per column.

    -

    Additionally, as of publication, PATRICK AFB in the Atlantic data source -actually contains eight columns; this is noted in -al_prblty_stations. SALINA CRUZ in -ep_prblty_stations is short one column.

    -

    I see no issues with the extra or missing data as I am unsure the value of -the data to begin with. A warning will be given so the user is aware, -but the important pieces (Location, Lat, Lon) all seem good.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/posest.html b/docs/reference/posest.html deleted file mode 100644 index 36ab7781..00000000 --- a/docs/reference/posest.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - -posest — posest • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Extrapolate data from Position Estimate products.

    - -
    - -
    posest(contents)
    - -

    Arguments

    - - - - - - -
    contents

    URL of a specific position estimate product

    - -

    Value

    - -

    Dataframe

    - -

    Details

    - -

    Given a direct link to a position estimate product, parse and return -dataframe of values.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/prblty.html b/docs/reference/prblty.html deleted file mode 100644 index 5a1d5db5..00000000 --- a/docs/reference/prblty.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - -prblty — prblty • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Parse strike probability products

    - -
    - -
    prblty(contents)
    - -

    Arguments

    - - - - - - -
    contents

    Link to a storm's specific strike probability advisory product.

    - -

    Value

    - -

    Dataframe

    - -

    Details

    - -

    Given a direct link to a strike probability advisory product, parse -and return dataframe of values.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/public.html b/docs/reference/public.html deleted file mode 100644 index 4b46d7f0..00000000 --- a/docs/reference/public.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - -public — public • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Parse Public Advisory products

    - -
    - -
    public(contents)
    - -

    Arguments

    - - - - - - -
    contents

    Link to a storm's specific public advisory product.

    - -

    Value

    - -

    Dataframe

    - -

    Details

    - -

    Given a direct link to a public advisory product, parse and return -dataframe of values.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/rrricanes.html b/docs/reference/rrricanes.html deleted file mode 100644 index 3bdfb0ea..00000000 --- a/docs/reference/rrricanes.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - -rrricanes — rrricanes • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    rrricanes is a web-scraping library for R designed to deliver -hurricane data (past and current) into well-organized datasets. With these -datasets you can explore past hurricane tracks, forecasts and structure -elements.

    -

    This documentation and additional help articles -can be found online.

    -

    Text products (Forecast/Advisory, Public Advisory, Discussions and -Probabilities) are only available from 1998 to current. An effort will be -made to add prior data as available.

    - -
    - - -

    Getting Storms

    - - -

    List all storms that have developed by year and basin. Year must be in a -four-digit format (%Y) and no earlier than 1998. Basin can be one or both -of Atlantic ("AL") or East Pacific ("EP").

    -
    get_storms

    List all storms by year, basin

    -
    - -

    Getting Storm Data

    - - -

    get_storm_data can be used to select multiple products, -multiple storms and from multiple basins.

    -

    Additional text products are:

    -
    get_discus

    Storm Discussions

    -
    get_fstadv

    Forecast/Advisory. These products contain a - bulk of the information for tropical cyclones including current position, - structure, forecast position and forecast structure.

    -
    get_posest

    Position Estimates. Rare and used generally - for threatening cyclones. This product was discontinued after the 2013 - season and is now issued as get_update.

    -
    get_prblty

    Strike Probabilities. Show the probability - of the center of a cyclone passing within 65nm of a location for a given - forecast period. This product was discontinued after 2005, replaced with - get_wndprb.

    -
    get_public

    Public Advisory. General non-structured - information exists in these products.

    -
    get_update

    Updates. Generally issued when a cyclone - undergoes a sudden change that requires immediate notice.

    -
    get_wndprb

    Wind Speed Probability. Lists the - probability of a location experiencing a minimum of 35kt, 50kt or 64kt - winds for an alotted forecast period or accumulated probability. This - product replaced get_prblty after the 2005 season.

    -
    -

    The products above may take some time to load if the NHC website is slow (as -is often the case, unfortunately). For all storm advisories issued outside -of the current month, use the rrricanesdata package.

    -

    To install rrricanesdata, run

    -

    -install.packages("rrricanesdata", - repos = "https://timtrice.github.io/drat/", - type = "source") -

    -

    See vignette("installing_rrricanesdata", package = "rrricanes") for -more information.

    - -

    GIS Data

    - - -

    For enhanced plotting of storm data, several GIS datasets are available. The -core GIS functions return URLs to help you refine the data you wish to view. -(Some products will not exist for all storms/advisories). These products are:

    -
    -
    gis_advisory

    Past track, current position, forecast - and wind radii

    -
    gis_breakpoints

    Breakpoints for watches and warnings

    -
    gis_latest

    All available GIS products for active - cyclones

    -
    gis_outlook

    Tropical Weather Outlook

    -
    gis_prob_storm_surge

    Probabilistic Storm Surge

    -
    gis_windfield

    Wind Radii

    -
    gis_wsp

    Wind Speed Probabilities

    -
    -

    gis_download will download the datasets from the above -functions.

    -

    Some GIS datasets will need to be converted to dataframes to plot geoms. Use -shp_to_df to convert SpatialLinesDataFrames and -SpatialPolygonsDataFrames. SpatialPointsDataFrames can be converted using -tibble::as_data_frame targeting the @data object.

    - -

    Package Options

    - - -

    dplyr.show_progress displays the dplyr progress bar when scraping raw -product datasets. In get_storms, it is based on the number of -years being requested. In the product functions (i.e., -get_fstadv) it is based on the number of advisories. It can be -misleading when calling get_storm_data because it shows the -progress of working through a storm's product advisories but will reset on -new products/storms.

    -

    dplyr.show_progress displays the dplyr progress bar when scraping raw -product datasets. In get_storms, it is based on the number of -years being requested. In the product functions (i.e., -get_fstadv) it is based on the number of advisories. It can be -misleading when calling get_storm_data because it shows the -progress of working through a storm's product advisories but will reset on -new products/storms.

    -

    rrricanes.working_msg is set to FALSE by default. When TRUE, it will -list the current storm, advisory and date being worked.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/saffir.html b/docs/reference/saffir.html deleted file mode 100644 index 4a47cbf1..00000000 --- a/docs/reference/saffir.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - -saffir — saffir • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Return category of tropical cyclone based on wind. Saffir- -Simpson Hurricane Scale does not apply to non-tropical cyclones.

    - -
    - -
    saffir(x)
    - -

    Arguments

    - - - - - - -
    x

    Vector of wind speed values.

    - - -

    Examples

    -
    saffir(c(32, 45, 70, 90, 110, 125, 140))
    #> [1] "TD" "TS" "HU1" "HU2" "HU3" "HU4" "HU5"
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/scrape_date.html b/docs/reference/scrape_date.html deleted file mode 100644 index d7eda7e2..00000000 --- a/docs/reference/scrape_date.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - -scrape_date — scrape_date • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Scrape date/time of product issuance from header.

    - -
    - -
    scrape_date(header)
    - -

    Arguments

    - - - - - - -
    header

    Header text of product.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/scrape_header.html b/docs/reference/scrape_header.html deleted file mode 100644 index fe4cd45f..00000000 --- a/docs/reference/scrape_header.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - -scrape_header — scrape_header • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Extract status, name, and advisory from products header.

    - -
    - -
    scrape_header(contents, ptn_product_title, advisory_number = TRUE)
    - -

    Arguments

    - - - - - - - - - - - - - - -
    contents

    Text product

    ptn_product_title

    Pattern of product title to match

    advisory_number

    Default is true; set to false if product does not -have an advisory number.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/scrape_key.html b/docs/reference/scrape_key.html deleted file mode 100644 index 8495f09c..00000000 --- a/docs/reference/scrape_key.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - -scrape_key — scrape_key • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Extract Key from header

    - -
    - -
    scrape_key(header)
    - -

    Arguments

    - - - - - - -
    header

    Header text of product.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/shp_to_df.html b/docs/reference/shp_to_df.html deleted file mode 100644 index a097597f..00000000 --- a/docs/reference/shp_to_df.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - -shp_to_df — shp_to_df • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Convert shapefile object to dataframe

    - -
    - -
    shp_to_df(obj)
    - -

    Arguments

    - - - - - - -
    obj

    Spatial object to convert. See details.

    - -

    Details

    - -

    Takes a SpatialLinesDataFrame object or SpatialPolygonsDataFrame -object and converts into a dataframe that can be plotted in ggplot2.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/status_abbr_to_str.html b/docs/reference/status_abbr_to_str.html deleted file mode 100644 index ef9391c8..00000000 --- a/docs/reference/status_abbr_to_str.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - -status_abbr_to_str — status_abbr_to_str • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Convert Status abbreviation to string

    - -
    - -
    status_abbr_to_str(x)
    - -

    Arguments

    - - - - - - -
    x

    character vector of status abbreviations

    - -

    Value

    - -

    character vector of strings

    - -

    Details

    - -

    Status abbreviations

    -
    DB

    Disturbance (of any intensity)

    -
    EX

    Extratropical cyclone (of any intensity)

    -
    HU

    Tropical cyclone of hurricane intensity (> 64 knots)

    -
    LO

    A low that is neither a tropical cyclone, a subtropical - cyclone, nor an extratropical cyclone (of any intensity)

    -
    SD

    Subtropical cyclone of subtropical depression intensity - (< 34 knots)

    -
    SS

    Subtropical cyclone of subtropical storm intensity - (> 34 knots)

    -
    TD

    Tropical cyclone of tropical depression intensity (< 34 knots)

    -
    TS

    Tropical cyclone of tropical storm intensity (34-63 knots)

    -
    WV

    Tropical Wave (of any intensity)

    -
    - -

    See also

    - - - - -

    Examples

    -
    # Extratropical Cyclone -status_abbr_to_str("EX")
    #> [1] "Extratropical Cyclone"
    -# Hurricane -status_abbr_to_str("HU")
    #> [1] "Hurricane"
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/tidy_adv.html b/docs/reference/tidy_adv.html deleted file mode 100644 index 153ea61f..00000000 --- a/docs/reference/tidy_adv.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - - -tidy_adv — tidy_adv • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Tidy current details of a fstadv dataframe object.

    -

    tidy_fstadv will be deprecated in 0.2.2

    - -
    - -
    tidy_adv(df)
    -
    -tidy_fstadv(df)
    - -

    Arguments

    - - - - - - -
    df

    fstadv dataframe object

    - -

    Details

    - -

    Returns current data only of a fstadv dataframe. Use Key, Adv and -Date to join with other tidy dataframes.

    -
    Key

    Unique identifier of cyclone

    -
    Adv

    Advisory number

    -
    Date

    Date and time of advisory

    -
    Status

    Classification of cyclone

    -
    Name

    Name of cyclone

    -
    Lat

    Latitude of cyclone center

    -
    Lon

    Longitude of cyclone center

    -
    Wind

    Maximum sustained one-minute winds in knots

    -
    Gust

    Maximum sustained one-minute gusts in knots

    -
    Pressure

    Minimum central pressure in millibars

    -
    PosAcc

    Position accuracy of cyclone in nautical miles

    -
    FwdDir

    Compass angle of forward motion

    -
    FwdSpeed

    Forward speed in miles per hour

    -
    Eye

    Size of eye in nautical miles

    -
    SeasNE

    Radius of 12ft seas in northeast quadrant

    -
    SeasSE

    Radius of 12ft seas in southeast quadrant

    -
    SeasSW

    Radius of 12ft seas in southwest quadrant

    -
    SeasNW

    Radius of 12ft seas in northwest quadrant

    -
    - - -

    Examples

    -
    # NOT RUN {
    -get_fstadv("http://www.nhc.noaa.gov/archive/1998/1998ALEXadv.html") %>%
    -  tidy_adv()
    -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/tidy_fcst.html b/docs/reference/tidy_fcst.html deleted file mode 100644 index 883f69cd..00000000 --- a/docs/reference/tidy_fcst.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - -tidy_fcst — tidy_fcst • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Tidy forecasts of a fstadv dataframe object.

    - -
    - -
    tidy_fcst(df)
    - -

    Arguments

    - - - - - - -
    df

    fstadv dataframe object

    - -

    Details

    - -

    Gathers all forecast points, tidies dataframe to make one row per -forecast position. Complete cases only. Use Key, Adv and Date to join with -other tidy dataframes.

    -
    -
    Key

    Unique identifier of cyclone

    -
    Adv

    Advisory number

    -
    Date

    Date and time of advisory

    -
    FcstDate

    Forecast date and time in UTC

    -
    Lat

    Forecast latitude

    -
    Lon

    Forecast Longitude

    -
    Wind

    Forecast wind in knots

    -
    Gust

    Forecast gust in knots

    -
    - - -

    Examples

    -
    # NOT RUN {
    -get_fstadv("http://www.nhc.noaa.gov/archive/1998/1998ALEXadv.html") %>%
    -  tidy_fcst()
    -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/tidy_fcst_wr.html b/docs/reference/tidy_fcst_wr.html deleted file mode 100644 index e7d1b677..00000000 --- a/docs/reference/tidy_fcst_wr.html +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - -tidy_fcst_wr — tidy_fcst_wr • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Tidy forecast wind radii of a fstadv dataframe object

    - -
    - -
    tidy_fcst_wr(df)
    - -

    Arguments

    - - - - - - -
    df

    fstadv dataframe object

    - -

    Details

    - -

    Tidies forecast wind radius for each forecast position. Complete -cases only (by quadrants). Use Key, Adv and Date to join with other tidy -dataframes.

    -
    -
    Key

    Unique identifier of cyclone

    -
    Adv

    Advisory number

    -
    Date

    Date and time of advisory

    -
    FcstDate

    Forecast date and time in UTC

    -
    WindField

    Minimum sustained wind field for quadrants

    -
    NE

    Radius in nautical miles for northeast quadrant

    -
    SE

    Radius in nautical miles for southeast quadrant

    -
    SW

    Radius in nautical miles for southwest quadrant

    -
    NW

    Radius in nautical miles for northwest quadrant

    -
    - - -

    Examples

    -
    # NOT RUN {
    -get_fstadv("http://www.nhc.noaa.gov/archive/1998/1998ALEXadv.html") %>%
    -  tidy_fcst_wr()
    -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/tidy_wr.html b/docs/reference/tidy_wr.html deleted file mode 100644 index 67f68735..00000000 --- a/docs/reference/tidy_wr.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - -tidy_wr — tidy_wr • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Tidy current wind radius of a fstadv dataframe object.

    - -
    - -
    tidy_wr(df)
    - -

    Arguments

    - - - - - - -
    df

    fstadv dataframe object

    - -

    Details

    - -

    Returns tidy dataframe of current wind radius values for a cyclone. -Returns only complete.cases (based on quadrants).

    -
    Key

    Unique identifier of cyclone

    -
    Adv

    Advisory number

    -
    Date

    Date and time of advisory

    -
    Windfield

    Minimum wind speed expected

    -
    NE

    Radius of `Windfield` in the northeast quadrant

    -
    SE

    Radius of `Windfield` in the southeast quadrant

    -
    SW

    Radius of `Windfield` in the southwest quadrant

    -
    NW

    Radius of `Windfield` in the northwest quadrant

    -
    - - -

    Examples

    -
    # NOT RUN {
    -get_fstadv("http://www.nhc.noaa.gov/archive/1998/1998ALEXadv.html") %>%
    -  tidy_wr()
    -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/tracking_chart.html b/docs/reference/tracking_chart.html deleted file mode 100644 index 6e89f0ea..00000000 --- a/docs/reference/tracking_chart.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - -tracking_chart — tracking_chart • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Build base tracking chart using ggplot

    - -
    - -
    tracking_chart(countries = TRUE, states = TRUE, res = 110, ...)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - -
    countries

    Show country borders. Default TRUE.

    states

    Show state boundaries. Default TRUE. Ignored if `countries` is -FALSE.

    res

    Resolution of charts; 110 (1:110m), 50 (1:50m), 10 (1:10m). -Default is low. The higher the resolution, the longer the plot takes to -appear.

    ...

    Additional ggplot2::aes parameters

    - -

    Value

    - -

    Returns ggplot2 object that can be printed directly or have new - layers added.

    - -

    See also

    - - - - -

    Examples

    -
    # NOT RUN {
    -# Build map with white land areas, thin black borders
    -tracking_chart(color = "black", size = 0.1, fill = "white")
    -
    -# 50nm resolution, no states
    -tracking_chart(res = 50, states = FALSE, color = "black", size = 0.1,
    -       fill = "white")
    -
    -# 50nm resolution, coastlines only
    -tracking_chart(countries = FALSE, res = 50, color = "black", size = 0.1,
    -       fill = "white")
    -
    -# Adding and modifying with ggplot functions
    -tracking_chart(color = "black", size = 0.1, fill = "white") +
    -  ggplot2::labs(x = "Lon", y = "Lat", title = "Base Tracking Chart")
    -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/twoal.html b/docs/reference/twoal.html deleted file mode 100644 index ca645ef0..00000000 --- a/docs/reference/twoal.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - -twoal — twoal • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Atlantic Tropical Weather Outlook

    - -
    - -
    twoal()
    - -

    Details

    - -

    This function parses the latest xml tropical weather outlook for -the Atlantic ocean. The core data is located in the `channel$item` element -where `title`, `description` and `pubDate` reside. `link` is also -available to point to the NHC website.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/twoep.html b/docs/reference/twoep.html deleted file mode 100644 index 13a9d143..00000000 --- a/docs/reference/twoep.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - -twoep — twoep • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    East Pacific Tropical Weather Outlook

    - -
    - -
    twoep()
    - -

    Details

    - -

    This function parses the latest xml tropical weather outlook for -the east Pacific. The core data is located in the `channel$item` element -where `title`, `description` and `pubDate` reside. `link` is also -available to point to the NHC website.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/update.html b/docs/reference/update.html deleted file mode 100644 index 06e63bc7..00000000 --- a/docs/reference/update.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - -update — update • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Parse cyclone update products

    - -
    - -
    update(contents)
    - -

    Arguments

    - - - - - - -
    contents

    Link to a storm's specific update advisory product.

    - -

    Value

    - -

    Dataframe

    - -

    Details

    - -

    Given a direct link to a cyclone update product, parse and return -dataframe of values.

    - -

    See also

    - - - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/wndprb.html b/docs/reference/wndprb.html deleted file mode 100644 index e1f3120d..00000000 --- a/docs/reference/wndprb.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - -wndprb — wndprb • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Parse wind probability products

    - -
    - -
    wndprb(contents)
    - -

    Arguments

    - - - - - - -
    contents

    Link to a storm's specific wind probability product.

    - -

    Details

    - -

    Given a direct link to a wind probability product, parse and return -dataframe of values.

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/reference/year_archives_link.html b/docs/reference/year_archives_link.html deleted file mode 100644 index 3fd23b71..00000000 --- a/docs/reference/year_archives_link.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - -year_archives_link — year_archives_link • rrricanes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Returns link to a year's archive page

    - -
    - -
    year_archives_link(year)
    - -

    Arguments

    - - - - - - -
    year

    4-digit numeric

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown 1.3.0.

    -
    -
    -
    - - - - - - diff --git a/docs/sitemap.xml b/docs/sitemap.xml deleted file mode 100644 index a4f838d2..00000000 --- a/docs/sitemap.xml +++ /dev/null @@ -1,294 +0,0 @@ - - - - https://ropensci.github.io/rrricanes//index.html - - - https://ropensci.github.io/rrricanes//reference/al_prblty_stations.html - - - https://ropensci.github.io/rrricanes//reference/al_tracking_chart.html - - - https://ropensci.github.io/rrricanes//reference/cp_prblty_stations.html - - - https://ropensci.github.io/rrricanes//reference/df.al_12_2005_prblty.html - - - https://ropensci.github.io/rrricanes//reference/df.al_18_2012.html - - - https://ropensci.github.io/rrricanes//reference/df.al_18_2012_fstadv.html - - - https://ropensci.github.io/rrricanes//reference/df.al_18_2012_wndprb.html - - - https://ropensci.github.io/rrricanes//reference/df.al_2012.html - - - https://ropensci.github.io/rrricanes//reference/df.gis_adv.html - - - https://ropensci.github.io/rrricanes//reference/df.gis_storm_surge.html - - - https://ropensci.github.io/rrricanes//reference/df.gis_wind_radii.html - - - https://ropensci.github.io/rrricanes//reference/df.gis_wsp.html - - - https://ropensci.github.io/rrricanes//reference/discus.html - - - https://ropensci.github.io/rrricanes//reference/ep_prblty_stations.html - - - https://ropensci.github.io/rrricanes//reference/ep_tracking_chart.html - - - https://ropensci.github.io/rrricanes//reference/extract_product_contents.html - - - https://ropensci.github.io/rrricanes//reference/extract_storm_links.html - - - https://ropensci.github.io/rrricanes//reference/extract_storms.html - - - https://ropensci.github.io/rrricanes//reference/extract_year_archive_link.html - - - https://ropensci.github.io/rrricanes//reference/filter_discus.html - - - https://ropensci.github.io/rrricanes//reference/filter_fstadv.html - - - https://ropensci.github.io/rrricanes//reference/filter_orig.html - - - https://ropensci.github.io/rrricanes//reference/filter_posest.html - - - https://ropensci.github.io/rrricanes//reference/filter_prblty.html - - - https://ropensci.github.io/rrricanes//reference/filter_public.html - - - https://ropensci.github.io/rrricanes//reference/filter_update.html - - - https://ropensci.github.io/rrricanes//reference/filter_wndprb.html - - - https://ropensci.github.io/rrricanes//reference/fstadv.html - - - https://ropensci.github.io/rrricanes//reference/fstadv_eye.html - - - https://ropensci.github.io/rrricanes//reference/fstadv_forecasts.html - - - https://ropensci.github.io/rrricanes//reference/fstadv_fwd_mvmt.html - - - https://ropensci.github.io/rrricanes//reference/fstadv_lat_lon.html - - - https://ropensci.github.io/rrricanes//reference/fstadv_pos_accuracy.html - - - https://ropensci.github.io/rrricanes//reference/fstadv_pressure.html - - - https://ropensci.github.io/rrricanes//reference/fstadv_prev_pos.html - - - https://ropensci.github.io/rrricanes//reference/fstadv_seas.html - - - https://ropensci.github.io/rrricanes//reference/fstadv_wind_radius.html - - - https://ropensci.github.io/rrricanes//reference/fstadv_winds_gusts.html - - - https://ropensci.github.io/rrricanes//reference/get_discus.html - - - https://ropensci.github.io/rrricanes//reference/get_fstadv.html - - - https://ropensci.github.io/rrricanes//reference/get_ftp_dirs.html - - - https://ropensci.github.io/rrricanes//reference/get_ftp_storm_data.html - - - https://ropensci.github.io/rrricanes//reference/get_nhc_ftp_link.html - - - https://ropensci.github.io/rrricanes//reference/get_nhc_link.html - - - https://ropensci.github.io/rrricanes//reference/get_posest.html - - - https://ropensci.github.io/rrricanes//reference/get_prblty.html - - - https://ropensci.github.io/rrricanes//reference/get_product.html - - - https://ropensci.github.io/rrricanes//reference/get_public.html - - - https://ropensci.github.io/rrricanes//reference/get_storm_data.html - - - https://ropensci.github.io/rrricanes//reference/get_storm_list.html - - - https://ropensci.github.io/rrricanes//reference/get_storms.html - - - https://ropensci.github.io/rrricanes//reference/get_update.html - - - https://ropensci.github.io/rrricanes//reference/get_url_contents.html - - - https://ropensci.github.io/rrricanes//reference/get_wndprb.html - - - https://ropensci.github.io/rrricanes//reference/gis_advisory.html - - - https://ropensci.github.io/rrricanes//reference/gis_breakpoints.html - - - https://ropensci.github.io/rrricanes//reference/gis_download.html - - - https://ropensci.github.io/rrricanes//reference/gis_latest.html - - - https://ropensci.github.io/rrricanes//reference/gis_outlook.html - - - https://ropensci.github.io/rrricanes//reference/gis_prob_storm_surge.html - - - https://ropensci.github.io/rrricanes//reference/gis_storm_surge_flood.html - - - https://ropensci.github.io/rrricanes//reference/gis_windfield.html - - - https://ropensci.github.io/rrricanes//reference/gis_wsp.html - - - https://ropensci.github.io/rrricanes//reference/knots_to_mph.html - - - https://ropensci.github.io/rrricanes//reference/mb_to_in.html - - - https://ropensci.github.io/rrricanes//reference/month_str_to_num.html - - - https://ropensci.github.io/rrricanes//reference/nm_to_sm.html - - - https://ropensci.github.io/rrricanes//reference/parse_stations.html - - - https://ropensci.github.io/rrricanes//reference/posest.html - - - https://ropensci.github.io/rrricanes//reference/prblty.html - - - https://ropensci.github.io/rrricanes//reference/public.html - - - https://ropensci.github.io/rrricanes//reference/rrricanes.html - - - https://ropensci.github.io/rrricanes//reference/saffir.html - - - https://ropensci.github.io/rrricanes//reference/scrape_date.html - - - https://ropensci.github.io/rrricanes//reference/scrape_header.html - - - https://ropensci.github.io/rrricanes//reference/scrape_key.html - - - https://ropensci.github.io/rrricanes//reference/shp_to_df.html - - - https://ropensci.github.io/rrricanes//reference/status_abbr_to_str.html - - - https://ropensci.github.io/rrricanes//reference/tidy_adv.html - - - https://ropensci.github.io/rrricanes//reference/tidy_fcst.html - - - https://ropensci.github.io/rrricanes//reference/tidy_fcst_wr.html - - - https://ropensci.github.io/rrricanes//reference/tidy_wr.html - - - https://ropensci.github.io/rrricanes//reference/tracking_chart.html - - - https://ropensci.github.io/rrricanes//reference/twoal.html - - - https://ropensci.github.io/rrricanes//reference/twoep.html - - - https://ropensci.github.io/rrricanes//reference/update.html - - - https://ropensci.github.io/rrricanes//reference/wndprb.html - - - https://ropensci.github.io/rrricanes//reference/year_archives_link.html - - - https://ropensci.github.io/rrricanes//articles/accumulated_cyclone_energy.html - - - https://ropensci.github.io/rrricanes//articles/forecast_advisory.html - - - https://ropensci.github.io/rrricanes//articles/getting_started.html - - - https://ropensci.github.io/rrricanes//articles/gis_data.html - - - https://ropensci.github.io/rrricanes//articles/installing_rrricanesdata.html - - - https://ropensci.github.io/rrricanes//articles/probabilistic_storm_surge.html - - - https://ropensci.github.io/rrricanes//articles/wind_pressure.html - - - https://ropensci.github.io/rrricanes//articles/wind_speed_probabilities.html - - diff --git a/man/al_tracking_chart.Rd b/man/al_tracking_chart.Rd deleted file mode 100644 index 6917a3e6..00000000 --- a/man/al_tracking_chart.Rd +++ /dev/null @@ -1,39 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/tracking_chart.R -\name{al_tracking_chart} -\alias{al_tracking_chart} -\title{al_tracking_chart} -\usage{ -al_tracking_chart(...) -} -\arguments{ -\item{...}{Additional parameters for \link{tracking_chart} and ggplot2} -} -\value{ -ggplot2 object centered on Atlantic basin. -} -\description{ -Build tracking chart centered on Atlantic Basin. -} -\examples{ -\dontrun{ -# Build map with white land areas, thin black borders -al_tracking_chart(color = "black", size = 0.1, fill = "white") - -# 50nm resolution, no states -al_tracking_chart(res = 50, states = FALSE, color = "black", size = 0.1, - fill = "white") - -# 50nm resolution, coastlines only -al_tracking_chart(countries = FALSE, res = 50, color = "black", size = 0.1, - fill = "white") - -# Adding and modifying with ggplot functions -al_tracking_chart(color = "black", size = 0.1, fill = "white") + - ggplot2::labs(x = "Lon", y = "Lat", - title = "Base Atlantic Tracking Chart") -} -} -\seealso{ -\code{\link{tracking_chart}} -} diff --git a/man/ep_tracking_chart.Rd b/man/ep_tracking_chart.Rd deleted file mode 100644 index 65f10859..00000000 --- a/man/ep_tracking_chart.Rd +++ /dev/null @@ -1,39 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/tracking_chart.R -\name{ep_tracking_chart} -\alias{ep_tracking_chart} -\title{ep_tracking_chart} -\usage{ -ep_tracking_chart(...) -} -\arguments{ -\item{...}{Additional parameters for ggplot2} -} -\value{ -ggplot2 object centered on northeast Pacific basin. -} -\description{ -Build tracking chart centered on northeast Pacific Basin. -} -\examples{ -\dontrun{ -# Build map with white land areas, thin black borders -ep_tracking_chart(color = "black", size = 0.1, fill = "white") - -# 50nm resolution, no states -ep_tracking_chart(res = 50, states = FALSE, color = "black", size = 0.1, - fill = "white") - -# 50nm resolution, coastlines only -ep_tracking_chart(countries = FALSE, res = 50, color = "black", size = 0.1, - fill = "white") - -# Adding and modifying with ggplot functions -ep_tracking_chart(color = "black", size = 0.1, fill = "white") + - ggplot2::labs(x = "Lon", y = "Lat", - title = "Base East Pacific Tracking Chart") -} -} -\seealso{ -\code{\link{tracking_chart}} -} diff --git a/man/gis_download.Rd b/man/gis_download.Rd index a2071bbd..0f8d10ee 100644 --- a/man/gis_download.Rd +++ b/man/gis_download.Rd @@ -4,12 +4,14 @@ \alias{gis_download} \title{gis_download} \usage{ -gis_download(url, ...) +gis_download(url, destdir = tempdir(), ...) } \arguments{ \item{url}{link to GIS dataset to download.} -\item{...}{additional parameters for rgdal::readOGR} +\item{destdir}{The destination directory to download and extract the zip file} + +\item{...}{additional parameters for file.path} } \description{ Get GIS data for storm. diff --git a/man/gis_prob_storm_surge.Rd b/man/gis_prob_storm_surge.Rd index cadcd88c..8cb297c5 100644 --- a/man/gis_prob_storm_surge.Rd +++ b/man/gis_prob_storm_surge.Rd @@ -52,8 +52,10 @@ gis_prob_storm_surge("AL092016", products = list("psurge" = 0)) gis_prob_storm_surge("AL092016", products = list("psurge" = 0, "esurge" = 10)) # Return all psurge0 products for Sep 2, 2016, storm AL092016 -gis_prob_storm_surge("AL092016", products = list("psurge" = 0), - datetime = "20160902") +gis_prob_storm_surge("AL092016", + products = list("psurge" = 0), + datetime = "20160902" +) } } \seealso{ diff --git a/man/rrricanes.Rd b/man/rrricanes.Rd index b30a41f4..94c4ec74 100644 --- a/man/rrricanes.Rd +++ b/man/rrricanes.Rd @@ -64,9 +64,7 @@ of the current month, use the \code{rrricanesdata} package. To install \code{rrricanesdata}, run \code{ -install.packages("rrricanesdata", - repos = "https://timtrice.github.io/drat/", - type = "source") +remotes::install_github("ropensci/rrricanesdata") } See \code{vignette("installing_rrricanesdata", package = "rrricanes")} for @@ -94,11 +92,6 @@ core GIS functions return URLs to help you refine the data you wish to view. \code{\link{gis_download}} will download the datasets from the above functions. - -Some GIS datasets will need to be converted to dataframes to plot geoms. Use -\code{\link{shp_to_df}} to convert SpatialLinesDataFrames and -SpatialPolygonsDataFrames. SpatialPointsDataFrames can be converted using -\code{tibble::as_data_frame} targeting the @data object. } \section{Package Options}{ diff --git a/man/shp_to_df.Rd b/man/shp_to_df.Rd deleted file mode 100644 index 99bb24c8..00000000 --- a/man/shp_to_df.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gis.R -\name{shp_to_df} -\alias{shp_to_df} -\title{shp_to_df} -\usage{ -shp_to_df(obj) -} -\arguments{ -\item{obj}{Spatial object to convert. See details.} -} -\description{ -Convert shapefile object to dataframe -} -\details{ -Takes a SpatialLinesDataFrame object or SpatialPolygonsDataFrame -object and converts into a dataframe that can be plotted in ggplot2. -} diff --git a/man/tracking_chart.Rd b/man/tracking_chart.Rd deleted file mode 100644 index a1d86a8e..00000000 --- a/man/tracking_chart.Rd +++ /dev/null @@ -1,48 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/tracking_chart.R -\name{tracking_chart} -\alias{tracking_chart} -\title{tracking_chart} -\usage{ -tracking_chart(countries = TRUE, states = TRUE, res = 110, ...) -} -\arguments{ -\item{countries}{Show country borders. Default TRUE.} - -\item{states}{Show state boundaries. Default TRUE. Ignored if `countries` is -FALSE.} - -\item{res}{Resolution of charts; 110 (1:110m), 50 (1:50m), 10 (1:10m). -Default is low. The higher the resolution, the longer the plot takes to -appear.} - -\item{...}{Additional ggplot2::aes parameters} -} -\value{ -Returns ggplot2 object that can be printed directly or have new - layers added. -} -\description{ -Build base tracking chart using ggplot -} -\examples{ -\dontrun{ -# Build map with white land areas, thin black borders -tracking_chart(color = "black", size = 0.1, fill = "white") - -# 50nm resolution, no states -tracking_chart(res = 50, states = FALSE, color = "black", size = 0.1, - fill = "white") - -# 50nm resolution, coastlines only -tracking_chart(countries = FALSE, res = 50, color = "black", size = 0.1, - fill = "white") - -# Adding and modifying with ggplot functions -tracking_chart(color = "black", size = 0.1, fill = "white") + - ggplot2::labs(x = "Lon", y = "Lat", title = "Base Tracking Chart") -} -} -\seealso{ -\code{\link[ggplot2]{aes}} -} diff --git a/reports/child_al.Rmd b/reports/child_al.Rmd deleted file mode 100644 index 8df3fe1a..00000000 --- a/reports/child_al.Rmd +++ /dev/null @@ -1,17 +0,0 @@ - -```{r keys_al} -keys_al <- keys[str_which(keys, "^AL.")] -``` - -```{r} -if (is_empty(keys_al)) { - src <- "There are no storms in the Atlantic basin." -} else { - src <- walk(keys_al, function(x) { - knit_expand(file = "child_storm.Rmd", - arguments = list(key = x)) - }) -} -``` - -`r knit(text = unlist(src))` diff --git a/reports/child_ep.Rmd b/reports/child_ep.Rmd deleted file mode 100644 index 6e2a4eeb..00000000 --- a/reports/child_ep.Rmd +++ /dev/null @@ -1,4 +0,0 @@ - -```{r keys_ep} -(keys_ep <- keys[str_which(keys, "^EP.")]) -``` diff --git a/reports/child_storm.Rmd b/reports/child_storm.Rmd deleted file mode 100644 index 89034a1e..00000000 --- a/reports/child_storm.Rmd +++ /dev/null @@ -1,50 +0,0 @@ - -### {{arguments$key}} - -```{r} -# Find names of relevant datasets -ds <- grep(sprintf("^%s.", arguments$key), names(gis), ignore.case = TRUE, - value = TRUE) -``` - - -```{r} -# 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)) -``` - -```{r} -# 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)) -``` - -```{r} -tracking_chart(color = "black", fill = "white", size = 0.1, res = 50) + - plot_points + - plot_fcst_points + - theme(legend.position = "bottom", - legend.box = "vertical") -``` - diff --git a/reports/latest.Rmd b/reports/latest.Rmd deleted file mode 100644 index ac51a30c..00000000 --- a/reports/latest.Rmd +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: "Latest Tropical Cyclone Activity" -output: - html_document: - toc: TRUE - code_folding: hide ---- - -```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = TRUE) -``` - -```{r libraries} -library(ggplot2) -library(HURDAT) -library(knitr) -library(purrr) -library(rrricanes) -library(rrricanesdata) -library(stringr) -library(tibble) -``` - -```{r gis_latest, message = FALSE} -gis <- flatten(gis_latest(verbose = FALSE)) -``` - -```{r keys} -# Keys of existing storms -keys <- str_extract(names(gis), "(^[[:alpha:]]{2}[[:digit:]]{6})") %>% - toupper() %>% - unique() %>% - .[complete.cases(.)] -``` - -## Atlantic Basin - -```{r al, child = "child_al.Rmd"} -``` - -## East Pacific Basin - -```{r ep, child = "child_ep.Rmd"} -``` diff --git a/reports/latest.html b/reports/latest.html deleted file mode 100644 index 7c49e587..00000000 --- a/reports/latest.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - -Latest Tropical Cyclone Activity - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - -
    library(HURDAT)
    -library(knitr)
    -library(purrr)
    -library(rrricanes)
    -
    ## rrricanes is not intended for use in emergency situations.
    -
    library(rrricanesdata)
    -library(stringr)
    -
    gis <- flatten(gis_latest(verbose = FALSE))
    -
    # Keys of existing storms
    -keys <- str_extract(names(gis), "(^[[:alpha:]]{2}[[:digit:]]{6})") %>% 
    -  toupper() %>% 
    -  unique() %>% 
    -  .[complete.cases(.)]
    -
    -

    Atlantic Basin

    -
    keys_al <- keys[str_which(keys, "^AL.")]
    -
    if (is_empty(keys_al)) {
    -  src <- "There are no storms in the Atlantic basin."
    -} else {
    -  src <- walk(keys_al, function(x) {
    -    knit_expand(file = "child_storm.Rmd", 
    -                arguments = list(key = x))
    -  })
    -}
    -

    AL112017

    -
    -
    -

    East Pacific Basin

    -
    (keys_ep <- keys[str_which(keys, "^EP.")])
    -
    ## [1] "EP142017"
    -
    - - - - -
    - - - - - - - - diff --git a/reports/practice.Rmd b/reports/practice.Rmd deleted file mode 100644 index e225b462..00000000 --- a/reports/practice.Rmd +++ /dev/null @@ -1,100 +0,0 @@ ---- -title: "Practice" -author: "Tim Trice" -date: "June 27, 2017" -output: html_document ---- - -```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = TRUE, - fig.align = "center") -``` - -```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = TRUE) -``` - -```{r libraries} -library(ggplot2) -library(HURDAT) -library(knitr) -library(purrr) -library(rrricanes) -library(rrricanesdata) -library(sp) -library(stringr) -library(tibble) -``` - -```{r gis_latest, message = FALSE} -gis <- flatten(gis_latest(verbose = FALSE)) -``` - -```{r} -pts <- as_data_frame(gis$AL112017_pts) -lin <- shp_to_df(gis$AL112017_lin) -windswath <- shp_to_df(gis$AL112017_windswath) -radii <- shp_to_df(gis$AL112017_radii) -initial_radii <- shp_to_df(gis$al112017_2017090409_initialradii) -fcst_radii <- shp_to_df(gis$al112017_2017090409_forecastradii) -fcst_pts <- as_data_frame(gis$al112017_020_5day_pts) -fcst_lin <- shp_to_df(gis$al112017_020_5day_lin) -fcst_cone <- shp_to_df(gis$al112017_020_5day_pgn) -``` - -```{r} -l <- list("bbox.pts" = bbox(gis$AL112017_pts), - "bbox.lin" = bbox(gis$AL112017_lin), - "bbox.windswath" = bbox(gis$AL112017_windswath), - "bbox.radii" = bbox(gis$AL112017_radii), - "bbox.initial_radii" = bbox(gis$al112017_2017090309_initialradii), - "bbox.fcst_radii" = bbox(gis$al112017_2017090309_forecastradii), - "bbox.fcst_pts" = bbox(gis$al112017_016_5day_pts), - "bbox.fcst_lin" = bbox(gis$al112017_016_5day_lin), - "bbox.fcst_cone" = bbox(gis$al112017_016_5day_pgn)) - -bb <- matrix(c(map(l, `[[`, 1) %>% flatten_dbl() %>% min(), - map(l, `[[`, 2) %>% flatten_dbl() %>% max()), - nrow = 2, - ncol = 2) -``` - -```{r} -# Current and past details -plot_lin <- geom_path(data = lin, aes(x = long, y = lat, color = STORMTYPE)) - -plot_pts <- geom_point(data = pts, - aes(x = LON, y = LAT, color = STORMTYPE, size = INTENSITY)) - -# Forecast details -plot_fcst_lin <- geom_path(data = fcst_lin, - aes(x = long, y = lat, color = STORMTYPE)) - -plot_fcst_pts <- geom_point(data = fcst_pts, - aes(x = LON, y = LAT, color = STORMTYPE, - size = MAXWIND)) -# Forecast cone -plot_fcst_cone <- geom_polygon(data = fcst_cone, - aes(x = long, y = lat, group = group, - fill = FCSTPRD), alpha = 0.25) - -# Wind radii details -plot_initial_radii <- geom_polygon(data = initial_radii, - aes(x = long, y = lat, group = group, - fill = factor(RADII)), - alpha = 0.25) -``` - -```{r} -tracking_chart(color = "black", fill = "white", size = 0.1, res = 50) + - plot_lin + - plot_pts + - plot_fcst_lin + - plot_fcst_pts + - plot_fcst_cone + - coord_equal(xlim = c(-80, -16), - ylim = c(11.5, 25)) + - theme(legend.position = "bottom", - legend.direction = "vertical") -``` - diff --git a/tests/testthat/helpers-data.R b/tests/testthat/helpers-data.R index a8d5527c..adf78fbf 100644 --- a/tests/testthat/helpers-data.R +++ b/tests/testthat/helpers-data.R @@ -44,7 +44,7 @@ files <- list( "fstadv" = c("mcp0394.001") ), "EP132014" = list( - "fstadv" = c("ep132014.fstadv.001.08220251") + "fstadv" = c("ep132014.fstadv.001.08220251") ) ) @@ -61,12 +61,13 @@ al_1998 <- get_storms(years = 1998, basins = "AL") al_2008 <- get_storms(years = 2008, basins = "AL") al_2017 <- get_storms(years = 2017, basins = "AL") -df.al_01_2017_products <- rrricanes:::get_storm_data(al_2017[[1,4]], - products = c("discus", "fstadv")) -df.al_09_2008_discus <- rrricanes:::get_discus(al_2008[[9,4]]) -df.al_09_2008_fstadv <- rrricanes:::get_fstadv(al_2008[[9,4]]) -df.al_09_2008_posest <- rrricanes:::get_posest(al_2008[[9,4]]) -df.al_01_1998_prblty <- rrricanes:::get_prblty(al_1998[[1,4]]) -df.al_09_2008_public <- rrricanes:::get_public(al_2008[[9,4]]) -df.al_09_2008_update <- rrricanes:::get_update(al_2008[[9,4]]) -df.al_09_2008_wndprb <- rrricanes:::get_wndprb(al_2008[[9,4]]) +df.al_01_2017_products <- rrricanes:::get_storm_data(al_2017[[1, 4]], + products = c("discus", "fstadv") +) +df.al_09_2008_discus <- rrricanes:::get_discus(al_2008[[9, 4]]) +df.al_09_2008_fstadv <- rrricanes:::get_fstadv(al_2008[[9, 4]]) +df.al_09_2008_posest <- rrricanes:::get_posest(al_2008[[9, 4]]) +df.al_01_1998_prblty <- rrricanes:::get_prblty(al_1998[[1, 4]]) +df.al_09_2008_public <- rrricanes:::get_public(al_2008[[9, 4]]) +df.al_09_2008_update <- rrricanes:::get_update(al_2008[[9, 4]]) +df.al_09_2008_wndprb <- rrricanes:::get_wndprb(al_2008[[9, 4]]) diff --git a/tests/testthat/helpers-functions.R b/tests/testthat/helpers-functions.R index 8535bf81..38764611 100644 --- a/tests/testthat/helpers-functions.R +++ b/tests/testthat/helpers-functions.R @@ -3,14 +3,11 @@ #' contents and collapses into a string. #' @param x File name located in inst/extdata directory. read_files <- function(x) { - f <- system.file("extdata", x, package = "rrricanes", mustWork = TRUE) - readChar(f, file.info(f)$size - ) + readChar(f, file.info(f)$size) } v <- function(r, c, link) { - content <- xml2::read_html(link) path <- sprintf( diff --git a/tests/testthat/test_base.R b/tests/testthat/test_base.R index 478b408a..30a75469 100644 --- a/tests/testthat/test_base.R +++ b/tests/testthat/test_base.R @@ -22,37 +22,37 @@ test_that("NHC Link", { ## ---- month_str_to_num() ----------------------------------------------------- test_that("Month Abbreviated String to Number", { - expect_identical(rrricanes:::month_str_to_num("JAN"), as.integer(1)) - expect_identical(rrricanes:::month_str_to_num("FEB"), as.integer(2)) - expect_identical(rrricanes:::month_str_to_num("MAR"), as.integer(3)) - expect_identical(rrricanes:::month_str_to_num("APR"), as.integer(4)) - expect_identical(rrricanes:::month_str_to_num("MAY"), as.integer(5)) - expect_identical(rrricanes:::month_str_to_num("JUN"), as.integer(6)) - expect_identical(rrricanes:::month_str_to_num("JUL"), as.integer(7)) - expect_identical(rrricanes:::month_str_to_num("AUG"), as.integer(8)) - expect_identical(rrricanes:::month_str_to_num("SEP"), as.integer(9)) - expect_identical(rrricanes:::month_str_to_num("OCT"), as.integer(10)) - expect_identical(rrricanes:::month_str_to_num("NOV"), as.integer(11)) - expect_identical(rrricanes:::month_str_to_num("DEC"), as.integer(12)) + expect_identical(rrricanes:::month_str_to_num("JAN"), as.integer(1)) + expect_identical(rrricanes:::month_str_to_num("FEB"), as.integer(2)) + expect_identical(rrricanes:::month_str_to_num("MAR"), as.integer(3)) + expect_identical(rrricanes:::month_str_to_num("APR"), as.integer(4)) + expect_identical(rrricanes:::month_str_to_num("MAY"), as.integer(5)) + expect_identical(rrricanes:::month_str_to_num("JUN"), as.integer(6)) + expect_identical(rrricanes:::month_str_to_num("JUL"), as.integer(7)) + expect_identical(rrricanes:::month_str_to_num("AUG"), as.integer(8)) + expect_identical(rrricanes:::month_str_to_num("SEP"), as.integer(9)) + expect_identical(rrricanes:::month_str_to_num("OCT"), as.integer(10)) + expect_identical(rrricanes:::month_str_to_num("NOV"), as.integer(11)) + expect_identical(rrricanes:::month_str_to_num("DEC"), as.integer(12)) }) test_that("Month Abbreviated String to Number Error", { - expect_error( - rrricanes:::month_str_to_num("JANN"), - "JANN is not a valid month abbreviation" - ) + expect_error( + rrricanes:::month_str_to_num("JANN"), + "JANN is not a valid month abbreviation" + ) }) ## ---- knots_to_mph() --------------------------------------------------------- test_that("Knots to Miles per Hour", { - expect_equal(knots_to_mph(91), 104.72093) - expect_equal(knots_to_mph(274), 315.313569) + expect_equal(knots_to_mph(91), 104.72093) + expect_equal(knots_to_mph(274), 315.313569) }) ## ---- mb_to_in() ------------------------------------------------------------- test_that("Millibars to Inches", { - expect_equal(mb_to_in(1010), 29.82528290171) - expect_equal(mb_to_in(888), 26.222624967048) + expect_equal(mb_to_in(1010), 29.82528290171) + expect_equal(mb_to_in(888), 26.222624967048) }) ## ---- nm_to_sm() ------------------------------------------------------------- @@ -62,21 +62,21 @@ test_that("Nautical Miles to Survey Miles", { ## ---- saffir() --------------------------------------------------------------- test_that("test saffir()", { - expect_identical( - saffir(c(32, 45, 70, 90, 110, 125, 140)), - c("TD", "TS", "HU1", "HU2", "HU3", "HU4", "HU5") - ) + expect_identical( + saffir(c(32, 45, 70, 90, 110, 125, 140)), + c("TD", "TS", "HU1", "HU2", "HU3", "HU4", "HU5") + ) }) ## ---- status_abbr_to_str() --------------------------------------------------- test_that("test status_abbr_to_str()", { - expect_identical(status_abbr_to_str("TD"), "Tropical Depression") - expect_identical(status_abbr_to_str("TS"), "Tropical Storm") - expect_identical(status_abbr_to_str("HU"), "Hurricane") - expect_identical(status_abbr_to_str("EX"), "Extratropical Cyclone") - expect_identical(status_abbr_to_str("SD"), "Subtropical Depression") - expect_identical(status_abbr_to_str("SS"), "Subtropical Storm") - expect_identical(status_abbr_to_str("LO"), "Low") - expect_identical(status_abbr_to_str("WV"), "Tropical Wave") - expect_identical(status_abbr_to_str("DB"), "Disturbance") + expect_identical(status_abbr_to_str("TD"), "Tropical Depression") + expect_identical(status_abbr_to_str("TS"), "Tropical Storm") + expect_identical(status_abbr_to_str("HU"), "Hurricane") + expect_identical(status_abbr_to_str("EX"), "Extratropical Cyclone") + expect_identical(status_abbr_to_str("SD"), "Subtropical Depression") + expect_identical(status_abbr_to_str("SS"), "Subtropical Storm") + expect_identical(status_abbr_to_str("LO"), "Low") + expect_identical(status_abbr_to_str("WV"), "Tropical Wave") + expect_identical(status_abbr_to_str("DB"), "Disturbance") }) diff --git a/tests/testthat/test_discus.R b/tests/testthat/test_discus.R index 86e69be5..0f9cc333 100644 --- a/tests/testthat/test_discus.R +++ b/tests/testthat/test_discus.R @@ -5,4 +5,3 @@ test_that("Test get_discus()", { expect_identical(al_09_2008_discus, df.al_09_2008_discus) }) - diff --git a/tests/testthat/test_filters.R b/tests/testthat/test_filters.R index e918a1fd..2b5746ee 100644 --- a/tests/testthat/test_filters.R +++ b/tests/testthat/test_filters.R @@ -3,7 +3,7 @@ context("Filters") #' Filters are to help extract product URL's from a storm's archive pages. test_that("Get products from storm archive", { # Test number of products for Katrina, 2005 - expect_equal(length(AL122005),154) + expect_equal(length(AL122005), 154) expect_equal(length(rrricanes:::filter_discus(AL122005)), 32) expect_equal(length(rrricanes:::filter_fstadv(AL122005)), 31) expect_equal(length(rrricanes:::filter_orig(AL122005)), 1) diff --git a/tests/testthat/test_fstadv.R b/tests/testthat/test_fstadv.R index fc7598dd..1d9e9e6a 100644 --- a/tests/testthat/test_fstadv.R +++ b/tests/testthat/test_fstadv.R @@ -3,33 +3,40 @@ test_that("Test tidy_fstadv()", { expect_warning(x <- rrricanes::tidy_fstadv(al_09_2008_fstadv)) expect_identical(dim(x), c(53L, 18L)) - expect_identical(names(x), c("Key", "Adv", "Date", "Status", "Name", "Lat", - "Lon", "Wind", "Gust", "Pressure", "PosAcc", - "FwdDir", "FwdSpeed", "Eye", "SeasNE", "SeasSE", - "SeasSW", "SeasNW")) + expect_identical(names(x), c( + "Key", "Adv", "Date", "Status", "Name", "Lat", + "Lon", "Wind", "Gust", "Pressure", "PosAcc", + "FwdDir", "FwdSpeed", "Eye", "SeasNE", "SeasSE", + "SeasSW", "SeasNW" + )) }) ## ---- * tidy_wr -------------------------------------------------------------- test_that("Test tidy_wr()", { x <- rrricanes::tidy_wr(al_09_2008_fstadv) expect_identical(dim(x), c(138L, 8L)) - expect_identical(names(x), c("Key", "Adv", "Date", "WindField", "NE", "SE", - "SW", "NW")) + expect_identical(names(x), c( + "Key", "Adv", "Date", "WindField", "NE", "SE", + "SW", "NW" + )) }) ## ---- * tidy_fcst ------------------------------------------------------------ test_that("Test tidy_fcst()", { x <- rrricanes::tidy_fcst(al_09_2008_fstadv) expect_identical(dim(x), c(336L, 8L)) - expect_identical(names(x), c("Key", "Adv", "Date", "FcstDate", "Lat", "Lon", - "Wind", "Gust")) + expect_identical(names(x), c( + "Key", "Adv", "Date", "FcstDate", "Lat", "Lon", + "Wind", "Gust" + )) }) ## ---- * tidy_fcst_wr --------------------------------------------------------- test_that("Test tidy_fcst_wr()", { x <- rrricanes::tidy_fcst_wr(al_09_2008_fstadv) expect_identical(dim(x), c(587L, 9L)) - expect_identical(names(x), c("Key", "Adv", "Date", "FcstDate", "WindField", - "NE", "SE", "SW", "NW")) + expect_identical(names(x), c( + "Key", "Adv", "Date", "FcstDate", "WindField", + "NE", "SE", "SW", "NW" + )) }) - diff --git a/tests/testthat/test_get_functions.R b/tests/testthat/test_get_functions.R index df398663..1121b415 100644 --- a/tests/testthat/test_get_functions.R +++ b/tests/testthat/test_get_functions.R @@ -20,31 +20,42 @@ test_that("URL Status", { ## ---- * HTML format ---------------------------------------------------------- #' Test that annual archive page formats haven't changed. test_that("HTML format", { - skip_on_cran() ## ---- * * 1998 ------------------------------------------------------------- #' 1998 expect_identical( v(1, 1, sprintf("%sarchive/1998/1998archive.shtml", get_nhc_link())), - "TROPICAL STORM ALEX") + "TROPICAL STORM ALEX" + ) expect_identical( v(29, 2, sprintf("%sarchive/1998/1998archive.shtml", get_nhc_link())), - "HURRICANE MADELINE") + "HURRICANE MADELINE" + ) ## ---- * * 2005 ------------------------------------------------------------- #' 2005 - expect_identical(v(1, 1, sprintf("%sarchive/2005/", get_nhc_link())), - "Tropical Storm ARLENE") - expect_identical(v(31, 2, sprintf("%sarchive/2005/", get_nhc_link())), - "Tropical Depression SIXTEEN-E") - expect_identical(v(59, 1, sprintf("%sarchive/2005/", get_nhc_link())), - "Tropical Storm ZETA") + expect_identical( + v(1, 1, sprintf("%sarchive/2005/", get_nhc_link())), + "Tropical Storm ARLENE" + ) + expect_identical( + v(31, 2, sprintf("%sarchive/2005/", get_nhc_link())), + "Tropical Depression SIXTEEN-E" + ) + expect_identical( + v(59, 1, sprintf("%sarchive/2005/", get_nhc_link())), + "Tropical Storm ZETA" + ) ## ---- * * 2016 ------------------------------------------------------------- #' 2016 - expect_identical(v(29, 1, sprintf("%sarchive/2016/", get_nhc_link())), - "Hurricane NICOLE") - expect_identical(v(41, 2, sprintf("%sarchive/2016/", get_nhc_link())), - "Tropical Storm TINA") + expect_identical( + v(29, 1, sprintf("%sarchive/2016/", get_nhc_link())), + "Hurricane NICOLE" + ) + expect_identical( + v(41, 2, sprintf("%sarchive/2016/", get_nhc_link())), + "Tropical Storm TINA" + ) }) ## ---- * Is Dataframe --------------------------------------------------------- @@ -54,18 +65,26 @@ test_that("Is Dataframe", { }) ## ---- * Column Names --------------------------------------------------------- -test_that('Column Names', { - expect_named(get_storms(2016, basin = "AL"), - c("Year", "Name", "Basin", "Link")) - expect_named(get_storms(2016, basin = "EP"), - c("Year", "Name", "Basin", "Link")) +test_that("Column Names", { + expect_named( + get_storms(2016, basin = "AL"), + c("Year", "Name", "Basin", "Link") + ) + expect_named( + get_storms(2016, basin = "EP"), + c("Year", "Name", "Basin", "Link") + ) }) ## ---- * Errors --------------------------------------------------------------- test_that("Errors", { - expect_error(get_storms(1997), - sprintf("Param `years` must be between 1998 and %s.", - lubridate::year(Sys.Date()))) + expect_error( + get_storms(1997), + sprintf( + "Param `years` must be between 1998 and %s.", + lubridate::year(Sys.Date()) + ) + ) }) ## ---- Get Storm Data --------------------------------------------------------- @@ -73,9 +92,11 @@ test_that("rrricanes:::get_storm_data()", { # ## ---- * 2017, AL, 01 ------------------------------------------------------- expect_identical(al_01_2017_products, df.al_01_2017_products) ## ---- * Errors ------------------------------------------------------------- - expect_error(rrricanes:::get_storm_data(al_2017[[1,4]], products = "test")) - expect_error(rrricanes:::get_storm_data(), - "argument \"links\" is missing, with no default") + expect_error(rrricanes:::get_storm_data(al_2017[[1, 4]], products = "test")) + expect_error( + rrricanes:::get_storm_data(), + "argument \"links\" is missing, with no default" + ) }) ## get_storm_list ---- @@ -91,12 +112,14 @@ test_that("rrricanes:::get_storm_data()", { # was prior, that will be the failure point. test_that("Get Storm List", { skip_on_travis() + skip_on_appveyor() quietly_get_storm_list <- purrr::quietly(.f = rrricanes::get_storm_list) storm_list <- quietly_get_storm_list() expect_output(str(storm_list$result), "21 variables") expect_identical( names(storm_list$result), - c("STORM_NAME", "RE", "X", "R2", "R3", "R4", "R5", "CY", "YYYY", "TY", "I", + c( + "STORM_NAME", "RE", "X", "R2", "R3", "R4", "R5", "CY", "YYYY", "TY", "I", "YYY1MMDDHH", "YYY2MMDDHH", "SIZE", "GENESIS_NUM", "PAR1", "PAR2", "PRIORITY", "STORM_STATE", "WT_NUMBER", "STORMID" ) diff --git a/tests/testthat/test_gis.R b/tests/testthat/test_gis.R index df15b11d..d2c324a2 100644 --- a/tests/testthat/test_gis.R +++ b/tests/testthat/test_gis.R @@ -2,15 +2,19 @@ context("Test GIS functions.") ## ---- gis_advisory ----------------------------------------------------------- test_that("gis_advisory", { - expect_identical(gis_advisory("AL092008", 32), - sprintf("%s%s%s", - rrricanes:::get_nhc_link(), - "gis/forecast/archive/", - "al092008_5day_032.zip")) + expect_identical( + gis_advisory("AL092008", 32), + sprintf( + "%s%s%s", + rrricanes:::get_nhc_link(), + "gis/forecast/archive/", + "al092008_5day_032.zip" + ) + ) }) ## ---- gis_breakpoints -------------------------------------------------------- -#TODO #109 +# TODO #109 # test_that("gis_breakpoints", { # expect_identical(gis_breakpoints(2017), # sprintf("%s%s%s", @@ -21,39 +25,54 @@ test_that("gis_advisory", { ## ---- gis_outlook ------------------------------------------------------------ test_that("gis_outlook", { - expect_identical(gis_outlook(), - sprintf("%s%s", - rrricanes:::get_nhc_link(), - "xgtwo/gtwo_shapefiles.zip")) + expect_identical( + gis_outlook(), + sprintf( + "%s%s", + rrricanes:::get_nhc_link(), + "xgtwo/gtwo_shapefiles.zip" + ) + ) }) ## ---- gis_prob_storm_surge --------------------------------------------------- test_that("gis_prob_storm_surge", { expect_identical( gis_prob_storm_surge("AL092016", - products = list("psurge" = 0), - datetime = "2016090306"), - sprintf("%s%s%s", - rrricanes:::get_nhc_link(), - "gis/storm_surge/", - "al092016_psurge0_2016090306.zip")) + products = list("psurge" = 0), + datetime = "2016090306" + ), + sprintf( + "%s%s%s", + rrricanes:::get_nhc_link(), + "gis/storm_surge/", + "al092016_psurge0_2016090306.zip" + ) + ) }) ## ---- gis_windfield ---------------------------------------------------------- test_that("gis_windfield", { - expect_identical(gis_windfield("AL142016", advisory = 30), - sprintf("%s%s%s", - rrricanes:::get_nhc_link(), - "gis/forecast/archive/", - "al142016_fcst_030.zip")) + expect_identical( + gis_windfield("AL142016", advisory = 30), + sprintf( + "%s%s%s", + rrricanes:::get_nhc_link(), + "gis/forecast/archive/", + "al142016_fcst_030.zip" + ) + ) }) ## ---- gis_wsp ---------------------------------------------------------------- test_that("NHC Link", { - expect_identical(gis_wsp(datetime = "2016100606", res = 0.5), - sprintf("%s%s%s", - rrricanes:::get_nhc_link(), - "gis/forecast/archive/", - "2016100606_wsp_120hrhalfDeg.zip")) + expect_identical( + gis_wsp(datetime = "2016100606", res = 0.5), + sprintf( + "%s%s%s", + rrricanes:::get_nhc_link(), + "gis/forecast/archive/", + "2016100606_wsp_120hrhalfDeg.zip" + ) + ) }) - diff --git a/tests/testthat/test_posest.R b/tests/testthat/test_posest.R index 86ddc2cd..536e2628 100644 --- a/tests/testthat/test_posest.R +++ b/tests/testthat/test_posest.R @@ -4,4 +4,3 @@ test_that("Test get_posest()", { expect_identical(al_09_2008_posest, df.al_09_2008_posest) }) - diff --git a/tests/testthat/test_prblty.R b/tests/testthat/test_prblty.R index e9e3e61c..80ea8836 100644 --- a/tests/testthat/test_prblty.R +++ b/tests/testthat/test_prblty.R @@ -4,4 +4,3 @@ test_that("get_prblty()", { expect_identical(al_01_1998_prblty, df.al_01_1998_prblty) }) - diff --git a/tests/testthat/test_products.R b/tests/testthat/test_products.R index 2694fe29..4b63fdc9 100644 --- a/tests/testthat/test_products.R +++ b/tests/testthat/test_products.R @@ -2,12 +2,12 @@ context("Test Product functions.") ## ---- twoal() ---------------------------------------------------------------- test_that("twoal()", { - x <- twoal() - expect_identical(is.list(x), TRUE) + x <- twoal() + expect_identical(is.list(x), TRUE) }) ## ---- twoep() ---------------------------------------------------------------- test_that("twoep()", { - x <- twoep() - expect_identical(is.list(x), TRUE) + x <- twoep() + expect_identical(is.list(x), TRUE) }) diff --git a/tests/testthat/test_public.R b/tests/testthat/test_public.R index 0c28dab5..890febb8 100644 --- a/tests/testthat/test_public.R +++ b/tests/testthat/test_public.R @@ -4,4 +4,3 @@ test_that("get_public", { expect_equal(al_09_2008_public, df.al_09_2008_public) }) - diff --git a/tests/testthat/test_scrapers.R b/tests/testthat/test_scrapers.R index ebcd54db..ebb5371a 100644 --- a/tests/testthat/test_scrapers.R +++ b/tests/testthat/test_scrapers.R @@ -108,5 +108,4 @@ test_that("Key", { rrricanes:::scrape_key(read_files(files$AL151999$fstadv[1])), "AL1599" ) - }) diff --git a/tests/testthat/test_tracking_chart.R b/tests/testthat/test_tracking_chart.R deleted file mode 100644 index c10bec64..00000000 --- a/tests/testthat/test_tracking_chart.R +++ /dev/null @@ -1,7 +0,0 @@ -context("Test tracking chart") - -## ---- tracking_chart() ------------------------------------------------------- -test_that("tracking_chart Errors", { - expect_error(tracking_chart(res = 20), - "Chart resolution must be 110, 50, 10") -}) diff --git a/tests/testthat/test_update.R b/tests/testthat/test_update.R index f5587ced..5d528127 100644 --- a/tests/testthat/test_update.R +++ b/tests/testthat/test_update.R @@ -4,4 +4,3 @@ test_that("get_update", { expect_identical(al_09_2008_update, df.al_09_2008_update) }) - diff --git a/tests/testthat/test_wndprb.R b/tests/testthat/test_wndprb.R index 5c4b5afe..d0902774 100644 --- a/tests/testthat/test_wndprb.R +++ b/tests/testthat/test_wndprb.R @@ -3,28 +3,36 @@ ## ---- * al_prblty_stations --------------------------------------------------- test_that("al_prblty_stations", { expect_warning(x <- rrricanes::al_prblty_stations(), - "Expected 7 pieces. Additional pieces discarded in 1 rows [90].", - fixed = TRUE) + "Expected 7 pieces. Additional pieces discarded in 1 rows [90].", + fixed = TRUE + ) expect_identical(dim(x), c(216L, 7L)) - expect_identical(names(x), - c("X1", "Location", "Lat", "Lon", "X5", "X6", "X7")) + expect_identical( + names(x), + c("X1", "Location", "Lat", "Lon", "X5", "X6", "X7") + ) }) ## ---- * cp_prblty_stations --------------------------------------------------- test_that("cp_prblty_stations", { expect_identical(dim(rrricanes::cp_prblty_stations()), c(168L, 7L)) - expect_identical(names(rrricanes::cp_prblty_stations()), - c("X1", "Location", "Lat", "Lon", "X5", "X6", "X7")) + expect_identical( + names(rrricanes::cp_prblty_stations()), + c("X1", "Location", "Lat", "Lon", "X5", "X6", "X7") + ) }) ## ---- * ep_prblty_stations --------------------------------------------------- test_that("ep_prblty_stations", { expect_warning(x <- rrricanes::ep_prblty_stations(), - "Expected 7 pieces. Missing pieces filled with `NA` in 1 rows [41].", - fixed = TRUE) + "Expected 7 pieces. Missing pieces filled with `NA` in 1 rows [41].", + fixed = TRUE + ) expect_identical(dim(x), c(168L, 7L)) - expect_identical(names(x), - c("X1", "Location", "Lat", "Lon", "X5", "X6", "X7")) + expect_identical( + names(x), + c("X1", "Location", "Lat", "Lon", "X5", "X6", "X7") + ) }) ## ---- * get_wndprb ----------------------------------------------------------- diff --git a/vignettes/forecast_advisory.Rmd b/vignettes/forecast_advisory.Rmd deleted file mode 100644 index 6ffff426..00000000 --- a/vignettes/forecast_advisory.Rmd +++ /dev/null @@ -1,154 +0,0 @@ ---- -title: "Forecast/Advisory GIS" -author: "Tim Trice" -date: "June 11, 2017" -output: html_document ---- - -```{r setup, include=FALSE} -knitr::opts_chunk$set( - echo = TRUE, - fig.width = 7, - fig.asp = 1, - fig.align = "center" -) -``` - -```{r, message = FALSE} -library(dplyr) -library(ggplot2) -library(rrricanes) -library(rrricanesdata) -library(sp) -``` - -```{r} -key <- "AL092008" -adv <- 42 -``` - -```{r} -fstadv <- fstadv %>% filter(Key == key, Adv <= adv) -``` - -### GIS Advisory Forecast Track, Cone of Uncertainty, and Watches/Warnings - -```{r} -gis_adv <- gis_advisory(key = key, advisory = adv) %>% gis_download() -``` - -Get bounding box of the forecast polygon. - -```{r} -bbox <- bbox(gis_adv$al092008.042_5day_pgn) -``` - -Generate a base plot of the Atlantic ocean. - -```{r} -(bp <- al_tracking_chart(color = "black", fill = "white", size = 0.1, res = 50)) -``` - -I like to add a little cushion for the map inset and forecast cone data. - -```{r} -lat_min <- bbox[2,1] - 5 -lat_max <- bbox[2,2] + 5 -lon_min <- bbox[1,1] - 10 -lon_max <- bbox[1,2] + 10 -``` - -Build a thin tracking map for the inset. - -```{r} -bp_inset <- ggplotGrob(bp + - geom_rect(mapping = aes(xmin = lon_min, xmax = lon_max, - ymin = lat_min, ymax = lat_max), - color = "red", alpha = 0) + - theme_bw() + - theme(axis.title = element_blank(), - axis.ticks = element_blank(), - axis.text.x = element_blank(), - axis.text.y = element_blank(), - plot.margin = margin(0, 0, 0, 0, "pt"))) -``` - -Modify original `bp` zoomed in on our area of interest. - -```{r} -(bp <- bp + - coord_equal(xlim = c(lon_min, lon_max), - ylim = c(lat_min, lat_max)) + - scale_x_continuous(expand = c(0, 0)) + - scale_y_continuous(expand = c(0, 0)) + - labs(x = "Lon", - y = "Lat", - caption = sprintf("rrricanes %s", packageVersion("rrricanes")))) -``` - -Combine `bp` and `bp_inset` to finalize initial base plot. `bp` will be a base plot without the inset. `bpi` will have the inset. - -```{r} -(bpi <- bp + annotation_custom(grob = bp_inset, xmin = lon_max - 5, - xmax = lon_max - 1, ymin = -Inf, - ymax = lat_min + 5)) -``` - -## Current Advisory Details - -Lines and Polygons spatial dataframes can be helpfully converted using `shp_to_df`. The original spatial dataframes can be plotted directly in `ggplot2` but, to my understanding, access to the other variables are not available. - -```{r} -# Convert object SpatialLinesDataframe to dataframe -shp_storm_lin <- shp_to_df(gis_adv$al092008.042_5day_lin) -shp_storm_ww <- shp_to_df(gis_adv$al092008.042_ww_wwlin) -# Convert object SpatialPolygonsDataframe to dataframe -shp_storm_pgn <- shp_to_df(gis_adv$al092008.042_5day_pgn) -``` - -Points dataframes can just be converted with `tibble::as_data_frame`. - -```{r} -# Convert object SpatialPointsDataframe to dataframe -shp_storm_pts <- as_data_frame(gis_adv$al092008.042_5day_pts) -``` - -Modify `shp_storm_pts$DVLBL` with full strings and ordered factor. - -```{r} -shp_storm_pts$DVLBL <- factor(shp_storm_pts$DVLBL, - levels = c("D", "S", "H"), - labels = c("Tropical Depression", - "Tropical Storm", - "Hurricane")) -``` - -Same with `shp_storm_pts$TCWW`: - -```{r} -shp_storm_ww$TCWW <- factor(shp_storm_ww$TCWW, - levels = c("TWA", "TWR", "HWA", "HWR"), - labels = c("Tropical Storm Watch", - "Tropical Storm Warning", - "Hurricane Watch", - "Hurricane Warning")) -``` - -```{r} -bpi + geom_polygon(data = shp_storm_pgn, - aes(x = long, y = lat, group = group), - alpha = 0.15, fill = "orange") + - geom_path(data = shp_storm_lin, aes(x = long, y = lat, group = group)) + - geom_point(data = shp_storm_pts, aes(x = LON, y = LAT, fill = DVLBL, - shape = DVLBL, size = MAXWIND)) + - geom_path(data = shp_storm_ww, aes(x = long, y = lat, color = TCWW, - group = group), size = 1) + - scale_shape_manual(values = c(21, 21, 21, 21)) + - guides(shape = guide_legend(override.aes = list(size = 3)), - size = guide_legend(nrow = 1)) + - theme(legend.position = "bottom", - legend.box = "vertical") -``` - -Very often, areas that are under a hurricane watch may also be under a tropical storm warning. The chart above does not show the hurricane watch area. - diff --git a/vignettes/gis_data.Rmd b/vignettes/gis_data.Rmd index a0d49f6c..f4f5c46b 100644 --- a/vignettes/gis_data.Rmd +++ b/vignettes/gis_data.Rmd @@ -1,15 +1,20 @@ --- -title: "GIS data" +title: "Retrieving and Plotting GIS Data" author: "Tim Trice" date: "`r Sys.Date()`" -output: rmarkdown::html_vignette +output: + rmarkdown::html_vignette: + toc: true + toc_depth: 3 vignette: > %\VignetteIndexEntry{GIS data} - %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} + %\VignetteEngine{knitr::rmarkdown} +editor_options: + chunk_output_type: console --- -```{r, message = FALSE} +```{r libraries, message = FALSE} library(dplyr) library(ggplot2) library(rrricanes) @@ -26,261 +31,658 @@ Some datasets require the use of the storm key and an optional advisory. Other p ## Build a Tracking Chart -There are three functions available to help you plot GIS data; `tracking_chart`, `al_tracking_chart` and `ep_tracking_chart`. `al_tracking_chart` and `ep_tracking_chart` are just helpers centered on the Atlantic and northeast Pacific ocean, respectively. +As of version 0.2.7, the built-in tracking chart functions have been removed. Users are encouraged to use the `rnaturalearthdata` and associated packages to build tracking charts. -```{r} -args(rrricanes::tracking_chart) +The `rnaturalearthdata` package has many shapefile datasets that can be used to make maps. For this article I will only need countries and states. I will use the resolution of 10 nautical miles (available in the `rnaturalearthhires` package). Each dataset is named `countries10` and `states10`. + +```{r base-plot, fig.width = 7, fig.asp = 0.75, fig.align = "center"} +p <- + ggplot() + + geom_sf( + data = sf::st_as_sf(rnaturalearthhires::countries10), + fill = "gray95", + color = "black", + size = 0.1 + ) + + geom_sf( + data = sf::st_as_sf(rnaturalearthhires::states10), + fill = "gray95", + size = 0.1 + ) +p ``` -The `countries` and `states` parameters are TRUE by default. This means a basic call to `tracking_chart` will return a map with country and state borders. The `res` parameter is resolution; one of 110, 50 or 10 nautical miles. Resolutions 110nm and 50nm can be used immediately. To use lower resolution you must install the `rnaturalearthdatahires` package from ropensci: +I'll also remove the padding around the plot and change the color of the seas (`panel.background`). -```{r, eval = FALSE} -install.packages("rnaturalearthhires", - repos = "http://packages.ropensci.org", - type = "source") +```{r base-plot-plus-scale, fig.width = 7, fig.asp = 0.75, fig.align = "center"} +p <- + p + + scale_x_continuous( + expand = c(0, 0) + ) + + scale_y_continuous( + expand = c(0, 0) + ) + + theme( + panel.background = element_rect(fill = "white"), + panel.grid.major = element_line(color = "black", size = 0.1) + ) + + labs( + x = "", + y = "", + caption = sprintf("rrricanes %s", packageVersion("rrricanes")) + ) +p ``` -`tracking_chart` will print a basic tracking chart (a map of the planet). +## GIS Datasets -```{r, fig.width = 7, fig.align = "center"} -tracking_chart() -``` +There are several datasets that are published for active cyclones. The following functions are designed to return the URL to those datasets: -You can pass typical `aes` parameters to refine the color and fill of the plot; remember the tracking chart is a ggplot object. +* `gis_advisory` +* `gis_prob_storm_surge` +* `gis_windfield` +* `gis_latest` (only for active storms) + +It's important to note that not every storm will have a dataset available. Nor are datasets consistent from one storm to the next. For example, as we'll see below, a forecast cone should have two polygons for a 72-hour and 120-hour forecast; in this example, they are both 120-hours. -```{r, fig.width = 7, fig.align = "center"} -tracking_chart(color = "black", fill = "white", size = 0.1) +Let's take a look at Hurricane Matthew (AL142016) and focus on advisory 37. + +```{r vars} +key <- "AL142016" +adv <- 37 ``` -You may choose to only show coastline data instead. In this case, just set the countries parameter to FALSE. +### Data Scraping + +The functions listed above do not retrieve the data. They only return the URLs. This is to give you the opportunity to modify your requests to get the specific data needed, if it exists. + +#### `gis_advisory` -```{r, fig.width = 7, fig.align = "center"} -tracking_chart(countries = FALSE, res = 50, color = "black", fill = "white", - size = 0.1) +The `gis_advisory` function returns the URL for the GIS dataset by `key` and `advisory` number. Remember, a storm's key should always be eight alphanumeric characters; + + + Basin identifier ("AL", "CP", or "EP") + + + Storm number for the year + + + The four digit year + +The `fstadv` product will always have the storm key. In earlier years, the "year" portion of the key was only the year without the century; you will need to add it. + +```{r gis-advisory-args} +args(gis_advisory) ``` -For the purposes of this vignette we'll focus on Atlantic storms. +We can test that an advisory package does exist for our specific advisory. -```{r, fig.width = 7, fig.align = "center"} -(p <- al_tracking_chart(color = "black", fill = "white", size = 0.1, res = 50)) +```{r gis-advisory} +gis_advisory(key = key, advisory = adv) ``` -The `res` parameter defines the resolution of the chart presented. Options are in 110nm, 50nm and 10nm. The lower the resolution the longer the chart takes to be built. +This should work. -States cannot be drawn on resolution greater than 50nm. +#### `gis_windfield` -## GIS Datasets +The `gis_windfield` product is relatively new so it may not exist for some storms. As with `gis_advisory`, we only need the storms' key and advisory. -There are several datasets that are published for active cyclones. The following functions are designed to return the URL to those datasets: +```{r gis-windfield-args} +args(gis_windfield) +``` -* `gis_advisory` -* `gis_prob_storm_surge` -* `gis_windfield` -* `gis_latest` +```{r gis-windfield} +gis_windfield(key = key, advisory = adv) +``` + +#### `gis_prob_storm_surge` -## Advisory Package +The function `gis_prob_storm_surge` also uses the `key` variable, but not the advisory; instead, it uses `datetime`. -```{r} -gis_advisory(key = "AL182012", advisory = "18") +There are two types of products that can be retrieved, "esurge" and "psurge". psurge shows the probability of a specific height (in feet) of storm surge affecting an area. Values between 0 and 20 can be used. + +```r +gis_prob_storm_surge( + key = key, + datetime = "2016100706", + products = list( + # esurge = 10 + psurge = 5 + ) +) ``` -```{r, eval = FALSE} -df.gis_adv <- gis_advisory(key = "AL182012", advisory = "18") %>% gis_download() +In the example above, we are requesting the probabilities of a 5-foot storm surge affecting the coastline and inland waterways. + +esurge shows the probability of a specific storm surge height exceeding the forecast height. Valid values are 10, 20, 30, 04, and 50. Note the commented section in the code above. + +The `products` parameter expects a list, though you do not need to include both products. Additionally, each product expects a numeric or numeric vector. If you make a broad general request, the National Hurricane Center requests no more than 80 requests per 10 seconds, so please be respectful. Unlike retrieving text products, there is no throttle in this package to download GIS datasets. + +Regarding `datetime`, this value should be that of the advisory time minus 3 hours not including minutes and seconds. Let's get that value for Matthew's #37 advisory. + +```{r datetime} +datetime <- + get_storms(years = "2016", basins = "AL") %>% + filter(Name == "Hurricane Matthew") %>% + pull(Link) %>% + get_fstadv() %>% + filter(Adv == adv) %>% + pull(Date) + +# Subtract 3 hours +datetime <- datetime - 3 * 60 * 60 + +# Turn into string without the seconds. Format is YYYYMMDDHH +datetime <- as.character.Date(datetime, "%Y%m%d%H") + +datetime ``` -```{r} -names(df.gis_adv) +Let's make sure we can get a psurge 5 product for this datetime value. + +```{r gis-prob-storm-surge} +gis_prob_storm_surge(key = key, products = list(psurge = 5), datetime = datetime) ``` -For this particular storm and advisory, included are the base line, point and polygon datasets along with a dataset for watches and warnings. The objects returned are spatial dataframes contained within the list of dataframes, `df.gis_adv`. +Looks good. -### Line track +##### `gis_wsp` -```{r} -str(df.gis_adv$al182012.018_5day_lin) -``` +Wind speed probabilities exist in the `gis_wsp` datasets. Like `gis_prob_storm_surge`, we will need `datetime`, but we will not need `key`. The last parameter is `res` (resolution). Valid values are 5, 0.5, and 0.1 degrees. The default is all three. Not all resolutions will be available for all storms. -As we're dealing with a SpatialLinesDataFrame which needs to be modified, you can use the helper function `shp_to_df` for plotting. +```{r gis-wsp-args} +args(gis_wsp) +``` -```{r} -fcst_line <- shp_to_df(df.gis_adv$al182012.018_5day_lin) +```{r gis-wsp} +# List of datasets for 5-degree resolution +gis_wsp(datetime = datetime, res = 0.5) ``` -```{r, fig.width = 7, fig.align = "center"} -p + geom_path(data = fcst_line, aes(long, lat, group = FCSTPRD)) +#### Downloading Data + +Now that we've explored the various functions, let's go about downloading the datasets to plot. For efficiency, I use a lot of `purrr` mapping functions here, loading each step into one variable. + +First, I want to load all of my URLs into one vector. + +```{r get-urls} +# Get URLs of GIS datasets to analyze +urls <- c( + # Advisory package + gis_advisory(key = key, advisory = adv), + + # Wind field (initial and forecast) package + gis_windfield(key = key, advisory = adv), + + # Storm surge probability package + gis_prob_storm_surge( + key = key, + products = list(psurge = 5), + datetime = datetime + ), + + # Wind speed probability package + gis_wsp(datetime = datetime, res = 0.5) +) ``` -There are two groups of data in the set: one for 72-hour forecast period and one for 120-hour. Grouping by `FCSTPRD` will show the forecast track correctly. +Previously, `gis_download` would download the datasets, extract the shapefiles and convert them, if possible, into dataframes. Thankfully, this is no longer necessary with various improvements in the `sp` and `ggplot2` packages. Now, the `gis_download` function will only download the zip files into a specified directory. For this vignette, we'll use a temporary directory, `tempdir`. -There is a pretty wide field of view on the map above. You can use `sp::bbox` to "zoom in" on the map. +```{r download-data} +# Set our download directory +destdir <- tempdir() -```{r} -(bb <- sp::bbox(df.gis_adv$al182012.018_5day_lin)) +# Download datasets +file_list <- + urls %>% + purrr::map(gis_download, destdir) %>% + purrr::flatten_chr() + +file_list ``` -```{r, fig.width = 7, fig.align = "center"} -(p2 <- p + geom_path(data = fcst_line, aes(long, lat, group = FCSTPRD)) + - coord_equal(xlim = c(bb[1,1] - 5, bb[1,2] + 5), - ylim = c(bb[2,1] - 5, bb[2,2] + 5))) +There are a lot of files here. Thankfully, we only care about the shapefiles (marked by the ".shp" extension). Let's filter those. + +```{r filter-shapefiles} +# Filter out shapefiles +shp_files <- grep(".shp$", file_list, value = TRUE) +shp_files ``` -### Point track +We can use `sf::st_read` to read in each shapefile as a shapefile dataframe. The output is quite verbose; you can pass the parameter `quiet` as TRUE. + +```{r read-shapefiles} +# Read in shapefiles +shp_df <- purrr::map(shp_files, ~ sf::st_read(file.path(destdir, .x))) +``` -Each forecast position is also included in the points dataframe. You can access this in the `df.gis_adv$al182012.018_5day_pts@data` object; no conversion necessary. +And, while not necessary, I will rename the list of dataframes, `shp_df`, to the names of their respective shapefiles minus the file extension. -```{r, fig.width = 7, fig.align = "center"} -(p3 <- p2 + geom_point(data = df.gis_adv$al182012.018_5day_pts@data, aes(LON, LAT))) +```{r name-shapefiles} +# Create names from shapefiles by removing file extension +shp_df <- rlang::set_names(shp_df, nm = tools::file_path_sans_ext(shp_files)) +names(shp_df) ``` -## Forecast Cone +This next stop is also not necessary. I actually found it a bit broad and rarely used it but will leave it here as an example. + +Each shapefile has a bounding box; this box is a zoomed-in coordinate map of each dataset. We can access the bounding box of each dataset with the `sf::st_bbox` function. + +For example, in our advisory package we have the forecast cones (a polygon shapefile). Let's see what the bounding box is for that dataset. -Forecast cone data is contained in the polygon dataset. To deal with this dataset you can use the `shp_to_df` function again or take the slightly longer way: +```{r st-bbox} +sf::st_bbox(shp_df$`al142016-037_5day_pgn`) +``` + +Our data is contained between approximately 71°W and 81°W (note the negatives -- the western hemisphere), and between 23°N and 34°N. Let's see where that is. -```{r} -fcst_cone <- df.gis_adv$al182012.018_5day_pgn -fcst_cone@data$id <- rownames(fcst_cone@data) -fcst_cone.points <- broom::tidy(fcst_cone, region = "id") -fcst_cone <- dplyr::left_join(fcst_cone.points, fcst_cone@data, by = "id") +```{r zoom-base-plot, fig.width = 7, fig.asp = 0.75, fig.align = "center"} +p + + coord_sf( + xlim = c( + sf::st_bbox(shp_df$`al142016-037_5day_pgn`)$xmin, + sf::st_bbox(shp_df$`al142016-037_5day_pgn`)$xmax + ), + ylim = c( + sf::st_bbox(shp_df$`al142016-037_5day_pgn`)$ymin, + sf::st_bbox(shp_df$`al142016-037_5day_pgn`)$ymax + ) + ) ``` -```{r, fig.width = 7, fig.align = "center"} -p3 + geom_polygon(data = fcst_cone %>% filter(FCSTPRD == 120), - aes(long, lat, group = group, fill = factor(FCSTPRD)), - alpha = 0.5) + - geom_polygon(data = fcst_cone %>% filter(FCSTPRD == 72), - aes(long, lat, group = group, fill = factor(FCSTPRD)), - alpha = 0.5) +Nice! + +I want to find the largest bounding box within the datasets for my map. For this, I calculate the area for each box of each dataset, identify which has the largest area then extract the bounding box for that dataset. + +Notice I only search the advisory package datasets for a bounding box. The probability datasets may contain data for other cyclones across the world making our bounding box (and subsequent maps) quite wide. I have no interest in that so kept the focus only on Matthew. + +```{r calculate-max-bbox} +# Find which shapefile has the largest bounding box. Proability datasets are +# excluded as they may contain data for other cyclones. This may depend on +# the storm. +x <- purrr::map(shp_df[c(1:4)], sf::st_bbox) %>% + # Calculate the coverage for each bbox + purrr::map_dbl(~(.x$xmax - .x$xmin) * (.x$ymax - .x$ymin)) %>% + # Extract which shapefile has the largest coverage area + which.max() + +# Get the bounding box +(bbox <- sf::st_bbox(shp_df[[x]])) ``` -Note that in some GIS packages the forecast cones may be identical (though they shouldn't be). I've noticed it with Hurricanes Ike and Matthew; it's in the raw dataset. +### Advisory Package -## Watches and Warnings +Each dataset returned by the `gis_advisory` function should contain four datasets. -You can also plot watches and warnings if any are in effect for the package release time. + + 5day_lin - A line plot of the forecast (previous track not included) + + + 5day_pgn - A polygon identifying the forecast cone or area the center of the storm could travel within a given period of time. + + + 5day_pts - A points dataframe identifying the current location and each forecast position. + + + ww_wwlin - Any existing watches and warnings. + +Let's go ahead and create a plot and then I'll explain in detail what I'm doing here. -```{r} -ww_line <- shp_to_df(df.gis_adv$al182012.018_ww_wwlin) +```{r plot-gis-advisory, fig.width = 7, fig.asp = 1, fig.align = "center", class.source = c("numberLines")} +p + + # Despite two forecast periods, the cones are identical for both. + geom_sf( + data = shp_df$`al142016-037_5day_lin`, + aes(geometry = geometry) + ) + + geom_point( + data = shp_df$`al142016-037_5day_pts`, + aes( + x = .data$LON, + y = .data$LAT, + fill = .data$DVLBL, + shape = .data$DVLBL, + size = .data$MAXWIND + ) + ) + + geom_sf( + data = shp_df$`al142016-037_ww_wwlin`, + aes( + geometry = .data$geometry, + color = factor(.data$TCWW) + ), + size = 2, + # key_glyph available as of ggplot 3.2.0 + key_glyph = draw_key_path + ) + + geom_sf( + data = shp_df$`al142016-037_5day_pgn`, + aes( + geometry = geometry, + ), + color = "antiquewhite3", + fill = "transparent" + ) + + scale_shape_manual(name = "Status", values = c(rep(21, 4))) + + scale_fill_discrete(name = "Status") + + scale_size_continuous(name = "Wind (kts)") + + scale_color_manual( + name = "Watches/Warnings", + limits = c("TWA", "TWR", "HWA", "HWR"), + values = c("orange", "blue", "pink", "red"), + labels = c( + "Tropical Storm Watch", + "Tropical Storm Warning", + "Hurricane Watch", + "Hurricane Warning" + ), + drop = FALSE + ) + + coord_sf( + # Give some more breathing room on the x axis + xlim = c(scales::expand_range(c(bbox$xmax, bbox$xmin), mul = 0.25)), + ylim = c( + bbox$ymin, + bbox$ymax + ), + expand = FALSE + ) + + guides( + color = guide_legend(nrow = 2, byrow = TRUE) + ) + + theme( + panel.ontop = TRUE, + panel.background = element_blank(), + panel.grid.major = element_line(color = "lightgray", size = 0.1), + legend.position = "bottom", + legend.box = "vertical" + ) + + labs(title = "Hurricane Matthew Advisory #37") ``` +#### Forecast Line -```{r, fig.width = 7, fig.align = "center"} -p3 + geom_path(data = ww_line, - aes(x = long, y = lat, group = group, color = TCWW), size = 1) +```{r shp-lin-str} +str(shp_df$`al142016-037_5day_lin`) ``` -In the example above you can see tropical storm warnings issued for the Bahamas, North Carolina and portions of the South Carolina and Florida coast while tropical storm watches are in effect for northern Florida and South Carolina. +Plotting the forecast line is nothing fancy though you could define different linestyles depending on the status of the storm (`STORMTYPE`) or the forecast period (`FCSTPRD`). Additional variables are pretty self-explanatory; `STORMNAME`, `ADVDATE`, `ADVISNUM`, `STORMNUM`, and `BASIN`. -## Probabilistic Storm Surge +```{r forecast-line, ref.label = "plot-gis-advisory", echo = c(3:6), eval = FALSE, attr.source = c(".numberLines", "startFrom='3'")} +``` -The Tropical Cyclone Storm Surge Probabilities data shows the probability, in percent, of a specified storm surge occurring during the forecast period indicated. The product is based upon an ensemble of Sea, Lake, and Overland Surge from Hurricanes (SLOSH) model runs using the National Hurricane Center (NHC) official advisory and accounts for track, size, and intensity errors based on historical errors. +#### Forecast Points -```{r} -gis_prob_storm_surge(key = "AL142016", products = list(psurge = 0), - datetime = "20161006") +```{r shp-pts-str} +str(shp_df$`al142016-037_5day_pts`) ``` -```{r, eval = FALSE} -df.gis_storm_surge <- gis_prob_storm_surge(key = "AL142016", - products = list(psurge = 0), - datetime = "20161006") %>% - last() %>% - gis_download() +The points shapefile contains the same variables as the line shapefile and more. I am unable to find official documentation so let me give my best here to explain some of the added variables. + + + `TAU` - This appears to be the time period in hours for each forecast point, gruoped by `FCSTPRD` + + + `MSLP` - Forecast minimum sea level pressure. "9999" values simply indicate no forecast MSLP was provided. + + + `TCDVLP` - The forecast status of the cyclone. + + + `DVLBL` - A shorter label for `TCDVLP` + + + `SSNUM` - Sorry, no idea... + + + `TCDIR` - Foreward direction of the storm + + + `TCSPD` - Foreward speed of the storm + +```{r forecast-points-geom, ref.label = "plot-gis-advisory", echo = c(7:16), eval = FALSE, attr.source = c(".numberLines", "startFrom='7'")} ``` -```{r} -prob_surge <- shp_to_df(df.gis_storm_surge$al142016_2016100618_gt0) -bb <- sp::bbox(df.gis_storm_surge$al142016_2016100618_gt0) +Since we have the added variables `LAT` and `LON`, and I wanted to customize the aesthetics a bit, I chose to use the layer `geom_point`. I set fill and shape to `DVLBL` and size to `MAXWIND`. I also wanted to customize the appearance of each point and, since I'll be using the color aesthetic for watches and warnings as well, I needed to customize these scales. + +```{r forecast-points-scale, ref.label = "plot-gis-advisory", echo = c(35:37), eval = FALSE, attr.source = c(".numberLines", "startFrom='35'")} ``` -```{r, fig.width = 7, fig.align = "center"} -p + geom_path(data = prob_surge, - aes(x = long, y = lat, group = group, color = PSurge00c), - size = 1, alpha = 0.5) + - coord_equal(xlim = c(bb[1,1], bb[1,2]), ylim = c(bb[2,1], bb[2,2])) +#### Watches and Warnings + +```{r wwlin-shp-str} +str(shp_df$`al142016-037_ww_wwlin`) ``` -## Current and Forecast Wind Field Radii +In the watches and warnings dataset we have the `TCWW` variable which identifies the watch/warning issued for each line. There are only four possible candidates here: + + + `TWA` - Tropical storm watch + + + `TWR` - Tropical storm warning + + + `HWA` - Hurricane watch + + + `HWR` - Hurricane warning -Wind radii data may also be available for some cyclone advisory packages. This is the radius to which a minimum sustained wind speed may be felt from the center of circulation. +I use the `geom_sf` layer and set the color aesthetic. I also increased the size of the lines to stand out a bit and, with the introduction of key glyphs in ggplot 3.2.0, changed the legend style. -```{r} -gis_windfield("AL142016", advisory = "33") +```{r wwlin-geom, ref.label = "plot-gis-advisory", echo = c(17:26), eval = FALSE, attr.source = c(".numberLines", "startFrom='17'")} ``` -```{r, eval = FALSE} -df.gis_wind_radii <- gis_windfield("AL142016", advisory = "33") %>% gis_download() +Since I'm already using color in the points layer, I needed to add an additional legend to identify the watches and warnings. I set the `drop` parameter to FALSE to ensure that all four keys show regardless of what is in the dataset. + +```{r wwlin-scale, ref.label = "plot-gis-advisory", echo = c(38:49), eval = FALSE, attr.source = c(".numberLines", "startFrom='38'")} ``` -```{r} -wf_init <- shp_to_df(df.gis_wind_radii$al142016_2016100606_initialradii) -bb <- sp::bbox(df.gis_wind_radii$al142016_2016100606_forecastradii) +Below, I break the legend into two rows. + +```{r wwlin-guide, ref.label = "plot-gis-advisory", echo = c(59:61), eval = FALSE, attr.source = c(".numberLines", "startFrom='59'")} ``` -```{r, fig.width = 7, fig.align = "center"} -(p4 <- p + geom_polygon(data = wf_init, - aes(x = long, y = lat, fill = factor(RADII)), alpha = 0.5) + - coord_equal(xlim = c(bb[1,1], bb[1,2]), ylim = c(bb[2,1], bb[2,2]))) +#### Forecast Cone + +The forecast cone is contained in the polygon dataset of the advisory package. Take a look at the structure. + +```{r pgn-shp-str} +str(shp_df$`al142016-037_5day_pgn`) ``` -Additionally, forecast wind radii data is also generally available in some packages +The geometry should be slightly different depending on the `FCSTPRD`. However, for this dataset, that is not the case. -```{r} -wf_fcst <- shp_to_df(df.gis_wind_radii$al142016_2016100606_forecastradii) +```{r pgn-identical} +identical( + shp_df$`al142016-037_5day_pgn`$geometry[1], + shp_df$`al142016-037_5day_pgn`$geometry[2] +) ``` -```{r, fig.width = 7, fig.align = "center"} -p4 + geom_polygon(data = wf_fcst, - aes(x = long, y = lat, group = group, fill = factor(RADII)), - alpha = 0.5) +I could have filled differently depending on different geometries; unfortunately it was just not possible. So I kept the `geom_sf` call simple. + +```{r pgn-plot, ref.label = "plot-gis-advisory", echo = c(27:34), eval = FALSE, attr.source = c(".numberLines", "startFrom='27'")} ``` -## Wind Speed Probabilities +### Forecast Wind Radii -Wind Speed probabilities show the chance of experiencing a minimum-sustained winds of 34, 50 and 64 knots with a given period of time (typically, 120 hours). These products are not storm-specific but are global so other active cyclones in other basins may also appear. +The forecast wind radii dataset should contain two datasets; one for the current wind radius and another for the forecast wind radii. -```{r} -gis_wsp(datetime = "2016100606", res = 0.5) +```{r wind-radii-str} +str(shp_df$al142016_2016100706_initialradii) +str(shp_df$al142016_2016100706_forecastradii) ``` -```{r, eval = FALSE} -df.gis_wsp <- - gis_download( - "https://www.nhc.noaa.gov/gis/forecast/archive/2016100606_wsp_120hrhalfDeg.zip" - ) -``` +The "initialradii" dataset will contain up to three observations for each radii: 34 knots, 50 knots, and 64 knots. This is the expected distance from the center of circulation that minimum n-force winds can be expected. -### Cumulative Probability for >34kt Winds +The "forecastradii" can have many observations. For forecast periods up to 36 hours, all wind radii may be provided if the storm is strong enough. At 48 and 72 hours, only 34 and 50 knot wind radii are provided. No forecast wind radii are provided beyond 72 hours. +<<<<<<< HEAD ```{r, fig.width = 7, fig.align = "center", error=T} bb <- sp::bbox(df.gis_wsp$`2016100606_wsp34knt120hr_halfDeg`) +======= +```{r plot-forecast-wind-radii, fig.width = 7, fig.asp = 1, fig.align = "center", class.source = c("numberLines")} +>>>>>>> 77991c4d27277d70396af597475ea5480bc3b42c p + geom_sf( - data = st_as_sf(df.gis_wsp$`2016100606_wsp34knt120hr_halfDeg`), - aes(color = PWIND120) + data = shp_df$al142016_2016100706_forecastradii, + aes( + geometry = geometry, + fill = factor(RADII) + ), + alpha = 0.25 + ) + + geom_sf( + data = shp_df$`al142016-037_5day_lin`, + aes(geometry = geometry) + ) + + geom_point( + data = shp_df$`al142016-037_5day_pts`, + aes( + x = .data$LON, + y = .data$LAT + ) + ) + + coord_sf( + xlim = c(-85, -70), + ylim = c(24, 37), + expand = FALSE ) + - coord_sf(xlim = c(bb[1,1], bb[1,2]), ylim = c(bb[2,1], bb[2,2])) + scale_fill_discrete( + name = "Forecast Wind Radii" + ) + + theme( + panel.ontop = TRUE, + panel.background = element_blank(), + panel.grid.major = element_line(color = "lightgray", size = 0.1), + legend.position = "bottom", + legend.box = "vertical" + ) + + labs(title = "Hurricane Matthew Forecast Wind Radii, Adv #37") +``` + +In the plot above I take the same approach as the advisory package but only keep the line track and points to keep the graph simple. To add the forecast wind radii, I again use the `geom_sf` layer providing the `fill` aesthetic based on `RADII`. Outside of the aesthetic, I set alpha to 0.25 to make underlying radii visible as well as land areas. + +```{r forecast-radii-geom, ref.label = "plot-forecast-wind-radii", echo = c(2:9), eval = FALSE, attr.source = c(".numberLines", "startFrom='2'")} ``` -Cumulative wind speed probability for >50kt winds: +The initialradii dataset was intentionally left out; as you can see it is included in the forecastradii package. + +### Wind Speed Probabilities + +As noted previously, wind speed probabilities can be provided in different resolutions. Recall that I went with the 0.5° resolution dataset. There are three packages in this dataset; proabilities of at least 34 knot winds, 50 knot winds, and 64 knot winds. +<<<<<<< HEAD ```{r, fig.width = 7, fig.align = "center", error=T} bb <- sp::bbox(df.gis_wsp$`2016100606_wsp50knt120hr_halfDeg`) +======= +```{r wsp-prb-str} +str(shp_df$`2016100706_wsp34knt120hr_halfDeg`) +str(shp_df$`2016100706_wsp50knt120hr_halfDeg`) +str(shp_df$`2016100706_wsp64knt120hr_halfDeg`) +``` + +Each dataset contains the variable `PWIND120`; the probability of n-speed winds up to 120 hours. + +```{r plot-wind-speed-probabilities, fig.width = 7, fig.asp = 1, fig.align = "center"} +>>>>>>> 77991c4d27277d70396af597475ea5480bc3b42c p + geom_sf( - data = st_as_sf(df.gis_wsp$`2016100606_wsp50knt120hr_halfDeg`), - aes(color = PWIND120) + data = shp_df$`2016100706_wsp64knt120hr_halfDeg`, + aes( + geometry = geometry, + # A little math to add % to legend + color = PWIND120/100, + size = PWIND120, + alpha = PWIND120 + ), ) + - coord_sf(xlim = c(bb[1,1], bb[1,2]), ylim = c(bb[2,1], bb[2,2])) + coord_sf( + xlim = c( + -85, + bbox$xmax + ), + ylim = c( + bbox$ymin, + 37.5 + ), + expand = FALSE + ) + + scale_color_continuous( + name = "", + breaks = c(0.25, 0.75), + labels = scales::percent, + low = "white", + high = "red" + ) + + scale_size_continuous(guide = "none") + + scale_alpha_continuous(guide = "none") + + theme( + panel.ontop = TRUE, + panel.background = element_blank(), + panel.grid.major = element_line(color = "lightgray", size = 0.1), + legend.position = "bottom", + legend.box = "vertical" + ) + + labs(title = "Wind Speed Probabilities (>34kts), Adv #37") +``` + +The plot above focuses only on the wind speed probabilities. The forecast track of the cyclone is quite clear. I made the size and alpha aesthetic based on `PWIND120` but removed those legends. I kept the color `aesthetic` which I divided by 100 to make a fraction (default is a real). With that, I applied `scales::percent` to the legend to show a percentage and changed the breaks. + +### Storm Surge Probabilities + +```{r prob-storm-surge-str} +str(shp_df$al142016_2016100706_gt5) ``` -Cumulative probability for >64kt winds: +Similar to the wind speed probabilities, storm surge probabilties only has three variables, the `POINTID`, `geometry`, and, because we requested the psurge product for 5-feet, `PSurge05c` (this name changes depending on the product and value). + +Note that unlike wind speed probabilities which is a point shapefile, this dataset is a polygon shapefile. +<<<<<<< HEAD ```{r, fig.width = 7, fig.align = "center", error=T} bb <- sp::bbox(df.gis_wsp$`2016100606_wsp64knt120hr_halfDeg`) +======= +```{r psurge, fig.width = 7, fig.asp = 1, fig.align = "center"} +>>>>>>> 77991c4d27277d70396af597475ea5480bc3b42c p + geom_sf( - data = st_as_sf(df.gis_wsp$`2016100606_wsp64knt120hr_halfDeg`), - aes(color = PWIND120) + data = shp_df$al142016_2016100706_gt5, + aes( + geometry = geometry, + color = PSurge05c/100 + ), ) + - coord_sf(xlim = c(bb[1,1], bb[1,2]), ylim = c(bb[2,1], bb[2,2])) + # Show Lake George, FL + geom_curve( + aes( + x = -82, + y = 28, + xend = -81.58, + yend = 29.2 + ), + curvature = -0.5, + arrow = arrow(length = unit(0.01, "npc")) + ) + + annotate( + "text", + x = -81.5, + y = 27.9, + label = "Lake George, FL", + size = 3 + ) + + coord_sf( + xlim = c( + -85, + -74 + ), + ylim = c( + 25, + 36 + ), + expand = FALSE + ) + + scale_color_continuous( + name = "", + breaks = c(0.25, 0.75), + labels = scales::percent, + low = "white", + high = "red" + ) + + theme( + panel.ontop = TRUE, + panel.background = element_blank(), + panel.grid.major = element_line(color = "lightgray", size = 0.1), + legend.position = "bottom", + legend.box = "vertical" + ) + + labs(title = "Hurricane Matthew Storm Surge Probabilities (>5ft), Adv #37") ``` + +I took similar steps to creating this plot as I did with wind speed probabilties. + +Note what appears to be storm surge well inland from the coast in Lake George, St. Johns River, and elsewhere. diff --git a/vignettes/installing_rrricanesdata.Rmd b/vignettes/installing_rrricanesdata.Rmd index 72bf2d6b..2a924bac 100644 --- a/vignettes/installing_rrricanesdata.Rmd +++ b/vignettes/installing_rrricanesdata.Rmd @@ -19,9 +19,7 @@ With `rrricanes` you can access current and archived advisories as-issued from t Installing `rrricanesdata` is simple: ```{r, eval = FALSE} -install.packages("rrricanesdata", - repos = "https://timtrice.github.io/drat/", - type = "source") +remotes::install_github("ropensci/rrricanesdata") ``` Data in `rrricanesdata` will be updated on the first of every month with a cutoff date of midnight on the last day of the month. So, advisories issued at any time during the current month will not be available; you will need to use any of `rrricanes` `get_*` functions. diff --git a/vignettes/probabilistic_storm_surge.Rmd b/vignettes/probabilistic_storm_surge.Rmd deleted file mode 100644 index fac622e2..00000000 --- a/vignettes/probabilistic_storm_surge.Rmd +++ /dev/null @@ -1,128 +0,0 @@ ---- -title: "Probabilistic Storm Surge" -author: "Tim Trice" -date: "June 11, 2017" -output: html_document ---- - -```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = TRUE, - fig.width = 10, - fig.asp = 1, - fig.align = "center") -``` - -```{r, message = FALSE} -library(dplyr) -library(ggplot2) -library(rrricanes) -library(rrricanesdata) -library(sp) -``` - -## Data - -```{r} -key <- "AL092008" -adv <- 42 -``` - -```{r} -fstadv <- fstadv %>% filter(Key == key, Adv <= adv) -``` - -## Probabilistic Storm Surge - -Calculate the last date/time of forecast/advisory product and subtract 3 hrs - -```{r} -dt <- (last(fstadv$Date) - (60 * 60 * 3)) %>% - strftime(format = "%Y%m%d%H", tz = "UTC") -``` - -Wrap `gis_download` in `safely`. Not all products will exist for every storm or even every advisory. - -I'm downloading the `psurge` products for 5 feet since there are no other storm surge products available for Ike. - -```{r} -dl <- purrr::safely(.f = gis_download) -gis_surge <- gis_prob_storm_surge(key, products = list("psurge" = c(5)), - datetime = dt) %>% dl() - -if (!is.null(gis_surge$error)) - message(gis_surge$error) -``` - -Generate a base plot of the Atlantic ocean. - -```{r} -bp <- al_tracking_chart(color = "black", fill = "white", size = 0.1, res = 50) -``` - -Since we're dealing with a polygon shapefile, we can get the bounding box of the dataset. - -```{r} -bbox <- bbox(gis_surge$result$al092008_2008091112_gt5) -``` - -Add a little cushion for the map inset. - -```{r} -lat_min <- bbox[2,1] - 2 -lat_max <- bbox[2,2] + 2 -lon_min <- bbox[1,1] - 4 -lon_max <- bbox[1,2] + 4 -``` - -Build a map inset. - -```{r} -bp_inset <- ggplotGrob(bp + - geom_rect(mapping = aes(xmin = lon_min, xmax = lon_max, - ymin = lat_min, ymax = lat_max), - color = "red", alpha = 0) + - theme_bw() + - theme(axis.title = element_blank(), - axis.ticks = element_blank(), - axis.text.x = element_blank(), - axis.text.y = element_blank(), - plot.margin = margin(0, 0, 0, 0, "pt"))) -``` - -Modify original `bp` zoomed in on our area of interest. - -```{r} -bp <- bp + - coord_equal(xlim = c(lon_min, lon_max), - ylim = c(lat_min, lat_max)) + - scale_x_continuous(expand = c(0, 0)) + - scale_y_continuous(expand = c(0, 0)) + - labs(x = "Lon", - y = "Lat", - caption = sprintf("rrricanes %s", packageVersion("rrricanes"))) -``` - -Combine `bp` and `bp_inset` to finalize initial base plot. `bp` will be a base plot without the inset. `bpi` will have the inset. - -```{r} -bpi <- bp + annotation_custom(grob = bp_inset, xmin = lon_max - 5, - xmax = lon_max - 1, ymin = -Inf, - ymax = lat_min + 5) -``` - -Convert the SpatialPolygonsDataframe to a dataframe. - -```{r} -shp_storm_surge <- shp_to_df(gis_surge$result$al092008_2008091112_gt5) -``` - -Probability of storm surge greater than five feet. - -```{r} -bpi + geom_point(data = shp_storm_surge, - aes(x = long, y = lat, color = ProbSurge05), size = 1) + - theme(legend.position = "bottom", - legend.box = "vertical") + - labs(title = "Probabilistic Storm Surge > 5ft", - caption = sprintf("rrricanes %s", packageVersion("rrricanes"))) -``` diff --git a/vignettes/wind_speed_probabilities.Rmd b/vignettes/wind_speed_probabilities.Rmd deleted file mode 100644 index f29bbb20..00000000 --- a/vignettes/wind_speed_probabilities.Rmd +++ /dev/null @@ -1,136 +0,0 @@ ---- -title: "Wind Speed Probabilities" -author: "Tim Trice" -date: "June 11, 2017" -output: html_document ---- - -```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = TRUE, - fig.width = 10, - fig.asp = 1, - fig.align = "center") -``` - -```{r, message = FALSE} -library(dplyr) -library(ggplot2) -library(rrricanes) -library(rrricanesdata) -library(sp) -``` - -```{r} -key <- "AL092008" -adv <- 42 -``` - -```{r} -wndprb <- wndprb %>% filter(Key == key, Adv <= adv) -``` - -### GIS Advisory Forecast Track, Cone of Uncertainty, and Watches/Warnings - -```{r} -gis_adv <- gis_advisory(key = key, advisory = adv) %>% gis_download() -``` - -Get bounding box of the forecast polygon. - -```{r} -bbox <- bbox(gis_adv$al092008.042_5day_pgn) -bbox -``` - -## Build a Tracking Chart - -Generate a base plot of the Atlantic ocean. - -```{r} -bp <- al_tracking_chart(color = "black", fill = "white", size = 0.1, res = 50) -bp -``` - -I like to add a little cushion for the map inset and forecast cone data. - -```{r} -lat_min <- bbox[2,1] - 5 -lat_max <- bbox[2,2] + 5 -lon_min <- bbox[1,1] - 10 -lon_max <- bbox[1,2] + 10 -``` - -Build a thin tracking map for the inset. - -```{r} -bp_inset <- ggplotGrob(bp + - geom_rect(mapping = aes(xmin = lon_min, xmax = lon_max, - ymin = lat_min, ymax = lat_max), - color = "red", alpha = 0) + - theme_bw() + - theme(axis.title = element_blank(), - axis.ticks = element_blank(), - axis.text.x = element_blank(), - axis.text.y = element_blank(), - plot.margin = margin(0, 0, 0, 0, "pt"))) -``` - -Modify original `bp` zoomed in on our area of interest. - -```{r} -bp <- bp + - coord_equal(xlim = c(lon_min, lon_max), - ylim = c(lat_min, lat_max)) + - scale_x_continuous(expand = c(0, 0)) + - scale_y_continuous(expand = c(0, 0)) + - labs(x = "Lon", - y = "Lat", - caption = sprintf("rrricanes %s", packageVersion("rrricanes"))) -bp -``` - -Combine `bp` and `bp_inset` to finalize initial base plot. `bp` will be a base plot without the inset. `bpi` will have the inset. - -```{r} -bpi <- bp + annotation_custom(grob = bp_inset, xmin = lon_max - 5, - xmax = lon_max - 1, ymin = -Inf, - ymax = lat_min + 5) -bpi -``` - -The `wndprb` will not have coordinates for cities. An option is `al_prblty_stations`. However, please note this function may become [deprecated](https://github.com/ropensci/rrricanes/issues/46). - -```{r} -wndprb <- - wndprb %>% - left_join(al_prblty_stations(), by = "Location") %>% - mutate_at(.vars = c("Lat", "Lon"), .funs = as.numeric) -``` - -Check `wndprb` for NA values in `Lat`, `Lon`. - -```{r} -any(is.na(wndprb$Lat), is.na(wndprb$Lon)) -``` - -```{r} -wndprb_adv42 <- filter(wndprb, Adv == adv, Wind >= 64) - -bpi + - geom_point( - data = wndprb_adv42, - aes( - x = Lon, - y = Lat, - color = Wind120Cum, - size = Wind120Cum - ) - ) + - scale_color_gradientn(colors = terrain.colors(10)) + - guides(size = FALSE) + - theme( - legend.position = "bottom", - legend.box = "vertical" - ) + - labs(title = "Total Probability of Wind >= 64kts within 120 Hours") -```