From 509833d8c72adba9a27991ba8843396b09d7f334 Mon Sep 17 00:00:00 2001 From: David Blodgett Date: Tue, 13 Sep 2022 11:20:42 -0500 Subject: [PATCH] cran submission commit for next release --- .Rbuildignore | 1 + .dockerignore | 9 +++++++++ NEWS.md | 6 ++++++ R/get_nldi.R | 4 ++++ R/get_oaproc.R | 16 +++++++++++++--- README.md | 7 +------ code.json | 10 +++++----- inst/CITATION | 2 +- man/get_elev_along_path.Rd | 3 ++- man/get_nldi_index.Rd | 4 ++++ man/get_raindrop_trace.Rd | 2 ++ man/get_split_catchment.Rd | 3 +++ man/get_xs_point.Rd | 4 +++- man/get_xs_points.Rd | 4 +++- tests/testthat/test_01_get_nldi.R | 2 ++ 15 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 .dockerignore diff --git a/.Rbuildignore b/.Rbuildignore index 7daa459c..378d1723 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -21,3 +21,4 @@ pkgdown .github Dockerfile data-raw +.dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..f432d0cc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.git +.github +pkgdown +docs +data-raw +rosm.cache +.Renviron +.Rproj.user +.Rhistory diff --git a/NEWS.md b/NEWS.md index 45f0ca62..c67db971 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +nhdplusTools 0.5.7 +========== + +- Update reference for updated flowline attributes. +- Fix failing example for cran checks. + nhdplusTools 0.5.6 ========== diff --git a/R/get_nldi.R b/R/get_nldi.R index ee7e47e8..9500f3ac 100644 --- a/R/get_nldi.R +++ b/R/get_nldi.R @@ -249,8 +249,12 @@ get_nldi_characteristics <- function(nldi_feature, type="local") { #' \donttest{ #' index <- get_nldi_index(c(-89.276, 42.988)) #' +#' if(inherits(index, "sf")) { +#' #' plot_nhdplus(bbox = sf::st_bbox(sf::st_buffer(index[1,], units::set_units(1000, "m")))) #' plot(sf::st_geometry(sf::st_transform(index, 3857)), add = TRUE) +#' +#' } #' } get_nldi_index <- function(location) { diff --git a/R/get_oaproc.R b/R/get_oaproc.R index 77e6b1ec..59843c86 100644 --- a/R/get_oaproc.R +++ b/R/get_oaproc.R @@ -15,6 +15,7 @@ #' #' (trace <- get_raindrop_trace(point)) #' +#' if(inherits(trace, "sf")) { #' bbox <- sf::st_bbox(trace) + c(-0.005, -0.005, 0.005, 0.005) #' #' nhdplusTools::plot_nhdplus(bbox = bbox, cache_data = FALSE) @@ -23,6 +24,7 @@ #' plot(sf::st_transform(sf::st_geometry(trace)[1], 3857), add = TRUE, col = "red") #' plot(sf::st_transform(sf::st_geometry(trace)[2], 3857), add = TRUE, col = "black") #' } +#' } #' get_raindrop_trace <- function(point, direction = "down") { @@ -58,6 +60,8 @@ get_raindrop_trace <- function(point, direction = "down") { #' #' trace <- get_raindrop_trace(point) #' +#' if(inherits(trace, "sf")) { +#' #' (snap_point <- sf::st_sfc(sf::st_point(trace$intersection_point[[1]]), #' crs = 4326)) #' @@ -92,6 +96,7 @@ get_raindrop_trace <- function(point, direction = "down") { #' plot(sf::st_transform(sf::st_geometry(catchment)[1], 3857), add = TRUE, col = "red") #' plot(sf::st_transform(sf::st_geometry(catchment)[2], 3857), add = TRUE, col = "black") #' plot(sf::st_transform(sf::st_sfc(pour_point, crs = 4326), 3857), add = TRUE, col = "white") +#' } #'} #' get_split_catchment <- function(point, upstream = TRUE) { @@ -122,6 +127,8 @@ get_split_catchment <- function(point, upstream = TRUE) { #' #' (xs <- get_xs_point(point, 300, 100)) #' +#' if(inherits(xs, "sf")) { +#' #' bbox <- sf::st_bbox(xs) + c(-0.005, -0.005, 0.005, 0.005) #' #' nhdplusTools::plot_nhdplus(bbox = bbox, cache_data = FALSE) @@ -130,7 +137,7 @@ get_split_catchment <- function(point, upstream = TRUE) { #' plot(sf::st_transform(sf::st_sfc(point, crs = 4326), 3857), add = TRUE) #' #' plot(xs$distance_m, xs$elevation_m) -#' +#' } #' } #' get_xs_point <- function(point, width, num_pts) { @@ -163,6 +170,8 @@ get_xs_point <- function(point, width, num_pts) { #' #' (xs <- get_xs_points(point1, point2, 100)) #' +#' if(inherits(xs, "sf")) { +#' #' bbox <- sf::st_bbox(xs) + c(-0.005, -0.005, 0.005, 0.005) #' #' nhdplusTools::plot_nhdplus(bbox = bbox, cache_data = FALSE) @@ -172,7 +181,7 @@ get_xs_point <- function(point, width, num_pts) { #' plot(sf::st_transform(sf::st_sfc(point2, crs = 4326), 3857), add = TRUE) #' #' plot(xs$distance_m, xs$elevation_m) -#' +#' } #' } #' get_xs_points <- function(point1, point2, num_pts, res = 1) { @@ -220,7 +229,8 @@ check_res <- function(res) { #' #' (xs <- get_elev_along_path(points, 100)) #' -#' if(!is.null(xs)) { +#' if(inherits(xs, "sf")) { +#' #' bbox <- sf::st_bbox(xs) + c(-0.005, -0.005, 0.005, 0.005) #' #' nhdplusTools::plot_nhdplus(bbox = bbox, cache_data = FALSE) diff --git a/README.md b/README.md index 215737b2..3257cf08 100644 --- a/README.md +++ b/README.md @@ -205,17 +205,12 @@ Other notes: - this package uses pkgdown. Running `pkgdown::build_site()` will refresh it. ## Disclaimer - -This information is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The information has not received final approval by the U.S. Geological Survey (USGS) and is provided on the condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from the authorized or unauthorized use of the information. +This software has been approved for release by the U.S. Geological Survey (USGS). Although the software has been subjected to rigorous review, the USGS reserves the right to update the software as needed pursuant to further analysis and review. No warranty, expressed or implied, is made by the USGS or the U.S. Government as to the functionality of the software and related material nor shall the fact of release constitute any such warranty. Furthermore, the software is released on condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from its authorized or unauthorized use. From: https://www2.usgs.gov/fsp/fsp_disclaimers.asp#5 This software is in the public domain because it contains materials that originally came from the U.S. Geological Survey, an agency of the United States Department of Interior. For more information, see the [official USGS copyright policy](https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits "official USGS copyright policy") -Although this software program has been used by the USGS, no warranty, expressed or implied, is made by the USGS or the U.S. Government as to the accuracy and functioning of the program and related program material nor shall the fact of distribution constitute any such warranty, and no responsibility is assumed by the USGS in connection therewith. -This software is provided "AS IS." - - [ ![CC0](https://i.creativecommons.org/p/zero/1.0/88x31.png) ](https://creativecommons.org/publicdomain/zero/1.0/) diff --git a/code.json b/code.json index af6dbddc..efe7f336 100644 --- a/code.json +++ b/code.json @@ -3,7 +3,7 @@ "name": "nhdplusTools", "organization": "U.S. Geological Survey", "description": "Tools for Using NHDPlus Data", - "version": "0.5.6", + "version": "0.5.7", "status": "Production", "permissions": { @@ -11,14 +11,14 @@ "licenses": [ { "name": "Public Domain, CC0-1.0", - "URL": "https://code.usgs.gov/water/nhdplusTools/-/blob/v0.5.6/LICENSE" + "URL": "https://code.usgs.gov/water/nhdplusTools/-/blob/v0.5.7/LICENSE" } ] }, "homepageURL": "https://code.usgs.gov/water/nhdplusTools/", - "downloadURL": "https://code.usgs.gov/water/nhdplusTools/-/archive/v0.5.6/nhdplusTools-v0.5.6.zip", - "disclaimerURL": "https://code.usgs.gov/water/nhdplusTools/-/blob/v0.5.6/DISCLAIMER.md", + "downloadURL": "https://code.usgs.gov/water/nhdplusTools/-/archive/v0.5.7/nhdplusTools-v0.5.7.zip", + "disclaimerURL": "https://code.usgs.gov/water/nhdplusTools/-/blob/v0.5.7/DISCLAIMER.md", "repositoryURL": "https://code.usgs.gov/water/nhdplusTools.git", "vcs": "git", @@ -41,7 +41,7 @@ }, "date": { - "metadataLastUpdated": "2022-08-06" + "metadataLastUpdated": "2022-09-10" } } ] diff --git a/inst/CITATION b/inst/CITATION index 20269c37..0f65d04c 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -8,7 +8,7 @@ bibentry(bibtype = "Manual", title = "nhdplusTools: Tools for Accessing and Working with the NHDPlus", publisher = "U.S. Geological Survey", address="Reston, VA", - version = "0.5.6", + version = "0.5.7", institution = "U.S. Geological Survey", year = 2022, url = "https://doi.org/10.5066/P97AS8JD", diff --git a/man/get_elev_along_path.Rd b/man/get_elev_along_path.Rd index 3991dd8e..3778c27c 100644 --- a/man/get_elev_along_path.Rd +++ b/man/get_elev_along_path.Rd @@ -36,7 +36,8 @@ points <- sf::st_as_sf(c(point1, point2, point3)) (xs <- get_elev_along_path(points, 100)) -if(!is.null(xs)) { +if(inherits(xs, "sf")) { + bbox <- sf::st_bbox(xs) + c(-0.005, -0.005, 0.005, 0.005) nhdplusTools::plot_nhdplus(bbox = bbox, cache_data = FALSE) diff --git a/man/get_nldi_index.Rd b/man/get_nldi_index.Rd index 63196c3b..b8655d53 100644 --- a/man/get_nldi_index.Rd +++ b/man/get_nldi_index.Rd @@ -19,7 +19,11 @@ location. \donttest{ index <- get_nldi_index(c(-89.276, 42.988)) +if(inherits(index, "sf")) { + plot_nhdplus(bbox = sf::st_bbox(sf::st_buffer(index[1,], units::set_units(1000, "m")))) plot(sf::st_geometry(sf::st_transform(index, 3857)), add = TRUE) + +} } } diff --git a/man/get_raindrop_trace.Rd b/man/get_raindrop_trace.Rd index 2df0b703..133af96c 100644 --- a/man/get_raindrop_trace.Rd +++ b/man/get_raindrop_trace.Rd @@ -28,6 +28,7 @@ point <- sf::st_sfc(sf::st_point(x = c(-89.2158, 42.9561)), crs = 4326) (trace <- get_raindrop_trace(point)) +if(inherits(trace, "sf")) { bbox <- sf::st_bbox(trace) + c(-0.005, -0.005, 0.005, 0.005) nhdplusTools::plot_nhdplus(bbox = bbox, cache_data = FALSE) @@ -36,5 +37,6 @@ plot(sf::st_transform(sf::st_sfc(point, crs = 4326), 3857), add = TRUE) plot(sf::st_transform(sf::st_geometry(trace)[1], 3857), add = TRUE, col = "red") plot(sf::st_transform(sf::st_geometry(trace)[2], 3857), add = TRUE, col = "black") } +} } diff --git a/man/get_split_catchment.Rd b/man/get_split_catchment.Rd index af55a962..f6ec18d7 100644 --- a/man/get_split_catchment.Rd +++ b/man/get_split_catchment.Rd @@ -27,6 +27,8 @@ point <- sf::st_sfc(sf::st_point(x = c(-89.2158, 42.9561)), crs = 4326) trace <- get_raindrop_trace(point) +if(inherits(trace, "sf")) { + (snap_point <- sf::st_sfc(sf::st_point(trace$intersection_point[[1]]), crs = 4326)) @@ -62,5 +64,6 @@ plot(sf::st_transform(sf::st_geometry(catchment)[1], 3857), add = TRUE, col = "r plot(sf::st_transform(sf::st_geometry(catchment)[2], 3857), add = TRUE, col = "black") plot(sf::st_transform(sf::st_sfc(pour_point, crs = 4326), 3857), add = TRUE, col = "white") } +} } diff --git a/man/get_xs_point.Rd b/man/get_xs_point.Rd index 816f4067..20ced1fc 100644 --- a/man/get_xs_point.Rd +++ b/man/get_xs_point.Rd @@ -29,6 +29,8 @@ point <- sf::st_sfc(sf::st_point(x = c(-105.97218, 36.17592)), crs = 4326) (xs <- get_xs_point(point, 300, 100)) +if(inherits(xs, "sf")) { + bbox <- sf::st_bbox(xs) + c(-0.005, -0.005, 0.005, 0.005) nhdplusTools::plot_nhdplus(bbox = bbox, cache_data = FALSE) @@ -37,7 +39,7 @@ plot(sf::st_transform(sf::st_geometry(xs), 3857), pch = ".", add = TRUE, col = " plot(sf::st_transform(sf::st_sfc(point, crs = 4326), 3857), add = TRUE) plot(xs$distance_m, xs$elevation_m) - +} } } diff --git a/man/get_xs_points.Rd b/man/get_xs_points.Rd index cbe6fa3b..eccb80df 100644 --- a/man/get_xs_points.Rd +++ b/man/get_xs_points.Rd @@ -31,6 +31,8 @@ point2 <- sf::st_sfc(sf::st_point(x = c(-105.97768, 36.17526)), crs = 4326) (xs <- get_xs_points(point1, point2, 100)) +if(inherits(xs, "sf")) { + bbox <- sf::st_bbox(xs) + c(-0.005, -0.005, 0.005, 0.005) nhdplusTools::plot_nhdplus(bbox = bbox, cache_data = FALSE) @@ -40,7 +42,7 @@ plot(sf::st_transform(sf::st_sfc(point1, crs = 4326), 3857), add = TRUE) plot(sf::st_transform(sf::st_sfc(point2, crs = 4326), 3857), add = TRUE) plot(xs$distance_m, xs$elevation_m) - +} } } diff --git a/tests/testthat/test_01_get_nldi.R b/tests/testthat/test_01_get_nldi.R index 4979c8a1..dadcf2b0 100644 --- a/tests/testthat/test_01_get_nldi.R +++ b/tests/testthat/test_01_get_nldi.R @@ -245,6 +245,8 @@ test_that("xs", { skip_on_cran() + skip("service down") + point <- sf::st_sfc(sf::st_point(x = c(-105.97218, 36.17592)), crs = 4326) xs <- get_xs_point(point, 300, 100)