From a2a65acaa1c4574965f0e08726ae9f756eb4d5eb Mon Sep 17 00:00:00 2001 From: David Blodgett Date: Thu, 9 May 2024 10:30:26 -0500 Subject: [PATCH 1/4] update disclaimer and code.json for release --- DISCLAIMER.md | 9 ++------- NEWS.md | 2 ++ code.json | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/DISCLAIMER.md b/DISCLAIMER.md index 6ac95f52..78d12505 100644 --- a/DISCLAIMER.md +++ b/DISCLAIMER.md @@ -1,13 +1,8 @@ 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://www.usgs.gov/office-of-science-quality-and-integrity/fundamental-science-practices#5 +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." - - diff --git a/NEWS.md b/NEWS.md index 0a31c693..e99cf307 100644 --- a/NEWS.md +++ b/NEWS.md @@ -17,6 +17,8 @@ for more. - Removed deprecated function `get_huc12` and `get_huc8` - Updated documentation of `get_huc()` and other web service functions. - added `nhdplusTools_cache_settings()` to control use of a `memoise` cache. #366 +- fix minor bug related to binding nhdplushr data together. #380 + nhdplusTools 1.0.0 ========== diff --git a/code.json b/code.json index ae798bf2..e618ced8 100644 --- a/code.json +++ b/code.json @@ -1,4 +1,43 @@ [ + { + "name": "nhdplusTools", + "organization": "U.S. Geological Survey", + "description": "Tools for Using NHDPlus Data", + "version": "v1.1.0", + "status": "Production", + "permissions": { + "usageType": "openSource", + "licenses": [ + { + "name": "Public Domain, CC0-1.0", + "URL": "https://code.usgs.gov/water/nhdplusTools/-/raw/v1.1.0/LICENSE.md" + } + ] + }, + "homepageURL": "https://code.usgs.gov/water/nhdplusTools/", + "downloadURL": "https://code.usgs.gov/water/nhdplusTools/-/archive/v1.1.0/nhdplustools-v1.1.0.zip", + "disclaimerURL": "https://code.usgs.gov/water/nhdplusTools/-/raw/v1.1.0/DISCLAIMER.md", + "repositoryURL": "https://code.usgs.gov/water/nhdplusTools.git", + "vcs": "git", + "laborHours": 1700, + "tags": [ + "R", + "nhdplus", + "USGS", + "water", + "v0.6.2" + ], + "languages": [ + "R" + ], + "contact": { + "name": "David Blodgett", + "email": "dblodgett@usgs.gov" + }, + "date": { + "metadataLastUpdated": "2024-05-09" + } + }, { "name": "nhdplusTools", "organization": "U.S. Geological Survey", From d0ffe9cbf42597852977c8fe3078569b4f6ba477 Mon Sep 17 00:00:00 2001 From: David Blodgett Date: Thu, 9 May 2024 10:30:57 -0500 Subject: [PATCH 2/4] ignore demo files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 20aee258..778c754e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ cran-comments.md CRAN-SUBMISSION temp.R revdep +docs/*demo* From 22e9a19cefdbd1b75fd624d6ffd31eab148d56f2 Mon Sep 17 00:00:00 2001 From: David Blodgett Date: Thu, 9 May 2024 12:11:24 -0500 Subject: [PATCH 3/4] donttest slow web call --- R/get_vaa.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/get_vaa.R b/R/get_vaa.R index b999b725..d0ff8d00 100644 --- a/R/get_vaa.R +++ b/R/get_vaa.R @@ -211,7 +211,9 @@ download_vaa <- function(path = get_vaa_path(updated_network), force = FALSE, up #' @importFrom utils read.delim #' @export #' @examples +#' \donttest{ #' get_characteristics_metadata() +#' } get_characteristics_metadata <- function(search, cache = TRUE) { out <- tryCatch({ From 78e079f281eff8a572b5b0874de268fc305c2844 Mon Sep 17 00:00:00 2001 From: David Blodgett Date: Thu, 9 May 2024 21:24:19 -0500 Subject: [PATCH 4/4] better unzip handling for nhdplushr --- R/downloading_tools.R | 17 ++++++++++++++++- man/get_characteristics_metadata.Rd | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/R/downloading_tools.R b/R/downloading_tools.R index 90b120f6..95e589ec 100644 --- a/R/downloading_tools.R +++ b/R/downloading_tools.R @@ -104,9 +104,24 @@ download_nhd_internal <- function(bucket, file_list_snip, prefix, nhd_dir, hu_li if(download_files & !dir.exists(gsub(".zip", ".gdb", out_file)) & !(length(gdb_in_dir) > 0 && !dir.exists(gdb_in_dir))) { + if(file.exists(out_file)) { + unlink(out_file) + } + httr::RETRY("GET", url, httr::write_disk(out_file), httr::progress()) - zip::unzip(out_file, exdir = out[length(out)]) + tryCatch({zip::unzip(out_file, exdir = out[length(out)])}, + error = function(e) { + warning("error unzipping with zip::unzip \n", + out_file, "\n", e, "\ntrying a different way", immediate. = TRUE) + files <- try(utils::unzip(out_file, exdir = out[length(out)])) + if(!inherits(files, "try-error")) { + warning("Success with utils::unzip", immediate. = TRUE) + } else { + warning("unzip of\n", out_file, + "\nfailed with utils and zip packages.\n", + "Try manually unzipping?", immediate. = TRUE)} + }) unlink(out_file) } else if(!download_files) { diff --git a/man/get_characteristics_metadata.Rd b/man/get_characteristics_metadata.Rd index 28639b6a..a40e3ab4 100644 --- a/man/get_characteristics_metadata.Rd +++ b/man/get_characteristics_metadata.Rd @@ -21,5 +21,7 @@ Watersheds for the Conterminous United States (ver. 3.0, January 2021): U.S. Geological Survey data release, \doi{10.5066/F7765D7V}. } \examples{ +\donttest{ get_characteristics_metadata() } +}