diff --git a/.Rbuildignore b/.Rbuildignore index ca5736d4..8e258972 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -4,7 +4,6 @@ LICENSE .travis.yml .lintr -inst/doc/*.html docs _pkgdown.yml data-raw @@ -29,3 +28,6 @@ revdep CLAUDE.md dev .claude +inst/build +vignettes/drainage_area_figures +PLAN.md diff --git a/.gitattributes b/.gitattributes index 176a458f..63fca60e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,3 @@ * text=auto + +pkgdown/assets/slides/3dhp_tools_gwtc_2026.html linguist-vendored \ No newline at end of file diff --git a/DESCRIPTION b/DESCRIPTION index e0fad5cb..c76290e8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -30,7 +30,6 @@ Depends: R (>= 4.1) Imports: hydroloom, dataRetrieval, dplyr, sf, units, magrittr, jsonlite, httr, xml2, R.utils, utils, tidyr, methods, maptiles, mapsf, fst, arrow, tools, zip, pbapply, memoise, digest Suggests: testthat, knitr, rmarkdown, ggmap, ggplot2, lwgeom, gifski, leaflet, httptest, future, future.apply, StreamCatTools, terra -Remotes: doi-usgs/hydroloom License: CC0 Encoding: UTF-8 RoxygenNote: 7.3.3 diff --git a/DISCLAIMER.md b/DISCLAIMER.md index 78d12505..83aa9400 100644 --- a/DISCLAIMER.md +++ b/DISCLAIMER.md @@ -1,8 +1,11 @@ Disclaimer ========== -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") +This software is preliminary or provisional and is subject to revision. It is +being provided to meet the need for timely best science. The software has not +received final approval by the U.S. Geological Survey (USGS). 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. The software 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 software. \ No newline at end of file diff --git a/NEWS.md b/NEWS.md index 92cf38c7..d46199f7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,7 @@ nhdplusTools 1.5.0 ========== -nhdplusTools 1.5.0 will be the last minor release of nhdplusTools before the package is renamed. Path releases may occur to fix minor issues or change things necessary for the name change, but the API is effectively frozen and all new dvelopment will go toward the replacement package `hydrogeofetch`. For more, see the README.md. +nhdplusTools 1.5.0 will be the last minor release of nhdplusTools before the package is renamed. Path releases may occur to fix minor issues or change things necessary for the name change, but the API is effectively frozen and all new development will go toward the replacement package `hydrogeofetch`. For more, see the README.md. This release adds drainage area estimation tooling that combines HUC12 areas with NHDPlusV2 catchments to produce drainage area estimates at arbitrary points on the network. diff --git a/R/downloading_tools.R b/R/downloading_tools.R index b280c19c..d8d3124f 100644 --- a/R/downloading_tools.R +++ b/R/downloading_tools.R @@ -265,9 +265,9 @@ download_rf1 <- function(outdir, message("Extracting data ...") - R.utils::gunzip(file, remove = FALSE, skip = T) + R.utils::gunzip(file, remove = FALSE, skip = TRUE) - path <- list.files(outdir, full.names = T)[!grepl("gz", list.files(outdir))] + path <- list.files(outdir, full.names = TRUE)[!grepl("gz", list.files(outdir))] path <- path[grepl("rf1", path)] message(paste("RF1 data extracted to:", path)) @@ -291,7 +291,7 @@ download_rf1 <- function(outdir, downloader <- function(dir, url, type, progress = TRUE){ if (!dir.exists(dir)) { - dir.create(dir, recursive = T) + dir.create(dir, recursive = TRUE) } file <- file.path(dir, basename(url)) diff --git a/README.Rmd b/README.Rmd index 0eb53243..03c02736 100644 --- a/README.Rmd +++ b/README.Rmd @@ -171,6 +171,16 @@ Given this, the package should be built locally to include vignettes using: devtools::build() ``` +An additional CRAN build environment variable also must be set to avoid submitting a vignette with very large embedded images. + +```r +Sys.setenv(BUILD_VIGNETTES = "TRUE", BUILD_VIGNETTES_CRAN = "TRUE") +devtools::build() + + +devtools::release() +``` + ### Check notes: In addition to typical R package checking, a Dockerfile is included in this repository. Once built, it can be run with the following command. diff --git a/README.md b/README.md index 13890b8a..36dc6012 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,12 @@ Downloads](https://cranlogs.r-pkg.org/badges/grand-total/nhdplusTools)](https:// ## Renaming to `hydrogeofetch` -`nhdplusTools` is being renamed to `hydrogeofetch` (hydrologic geospatial -fabric extraction tool chain). The package’s scope has grown beyond -NHDPlus, and the name is no longer accurate. `hydrogeofetch` will be a -pure rename. Functions, function signatures, behavior, will all stay the -same. `hydrogeofetch` will be published to CRAN as a new package. +`nhdplusTools` is being renamed to `hydrogeofetch` (hydrologic +geospatial fabric extraction tool chain). The package’s scope has grown +beyond NHDPlus, and the name is no longer accurate. `hydrogeofetch` will +be a pure rename. Functions, function signatures, behavior, will all +stay the same. `hydrogeofetch` will be published to CRAN as a new +package. Development on `nhdplusTools` has stopped; only critical bug fixes will be applied. Once `hydrogeofetch` v1.0 is released, `nhdplusTools` will @@ -208,6 +209,17 @@ using: devtools::build() ``` +An additional CRAN build environment variable also must be set to avoid +submitting a vignette with very large embedded images. + +``` r +Sys.setenv(BUILD_VIGNETTES = "TRUE", BUILD_VIGNETTES_CRAN = "TRUE") +devtools::build() + + +devtools::release() +``` + ### Check notes: In addition to typical R package checking, a Dockerfile is included in @@ -262,23 +274,14 @@ documentation. - this package uses pkgdown. Running # Disclaimer -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: - -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") +This software is preliminary or provisional and is subject to revision. +It is being provided to meet the need for timely best science. The +software has not received final approval by the U.S. Geological Survey +(USGS). 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. The +software 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 software. [![CC0](https://i.creativecommons.org/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/) diff --git a/docs/404.html b/docs/404.html index a62bcbde..01cfce83 100644 --- a/docs/404.html +++ b/docs/404.html @@ -38,7 +38,7 @@ nhdplusTools - 1.5.0.9000 + 1.5.0 diff --git a/docs/CLAUDE.html b/docs/CLAUDE.html index b50769e4..b81e1ed6 100644 --- a/docs/CLAUDE.html +++ b/docs/CLAUDE.html @@ -17,7 +17,7 @@ nhdplusTools - 1.5.0.9000 + 1.5.0 @@ -53,6 +53,30 @@

NA

+
+

Rename to hydrogeofetch +

+

nhdplusTools is being renamed to hydrogeofetch (hydrologic geospatial fabric extraction tool chain) with a 2-year sunset ending October 2028, at which point nhdplusTools will be archived on CRAN.

+

When working in this repo, treat nhdplusTools as frozen and hydrogeofetch v1.x as the future canonical line. Avoid signature changes to public functions — they break the shim.

+

Commands

Style

diff --git a/docs/DISCLAIMER.html b/docs/DISCLAIMER.html index 67633441..530c10c2 100644 --- a/docs/DISCLAIMER.html +++ b/docs/DISCLAIMER.html @@ -17,7 +17,7 @@ nhdplusTools - 1.5.0.9000 + 1.5.0
@@ -54,9 +54,7 @@

Disclaimer

-

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

+

This software is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The software has not received final approval by the U.S. Geological Survey (USGS). 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. The software 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 software.

diff --git a/docs/LICENSE.html b/docs/LICENSE.html index 7cfe3188..ec877936 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -17,7 +17,7 @@ nhdplusTools - 1.5.0.9000 + 1.5.0 diff --git a/docs/articles/drainage_area_estimation.html b/docs/articles/drainage_area_estimation.html index e108b663..709c4fca 100644 --- a/docs/articles/drainage_area_estimation.html +++ b/docs/articles/drainage_area_estimation.html @@ -37,7 +37,7 @@ nhdplusTools - 1.5.0.9000 + 1.5.0 @@ -105,6 +105,8 @@

https://doi-usgs.github.io/nhdplusTools/articles/drainage_area_estimation.html.

get_drainage_area_estimates() combines Watershed Boundary Dataset (WBD) delineations and non-surface-contributing area estimates with National Hydrography Dataset Plus version 2 (NHDPlusV2) diff --git a/docs/articles/index.html b/docs/articles/index.html index 90611531..7a3eb3bf 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -17,7 +17,7 @@ nhdplusTools - 1.5.0.9000 + 1.5.0 diff --git a/docs/articles/nhdplushr.html b/docs/articles/nhdplushr.html index 794faffe..bb06164c 100644 --- a/docs/articles/nhdplushr.html +++ b/docs/articles/nhdplushr.html @@ -37,7 +37,7 @@ nhdplusTools - 1.5.0.9000 + 1.5.0 diff --git a/docs/articles/nhdplushr_files/figure-html/plot-1.png b/docs/articles/nhdplushr_files/figure-html/plot-1.png index 3c20eda7..cc63d982 100644 Binary files a/docs/articles/nhdplushr_files/figure-html/plot-1.png and b/docs/articles/nhdplushr_files/figure-html/plot-1.png differ diff --git a/docs/articles/nhdplushr_files/figure-html/tldr-1.png b/docs/articles/nhdplushr_files/figure-html/tldr-1.png index 4c3b0685..fc69e876 100644 Binary files a/docs/articles/nhdplushr_files/figure-html/tldr-1.png and b/docs/articles/nhdplushr_files/figure-html/tldr-1.png differ diff --git a/docs/authors.html b/docs/authors.html index 1218ca3a..c7af909b 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -17,7 +17,7 @@ nhdplusTools - 1.5.0.9000 + 1.5.0 @@ -89,7 +89,7 @@

Citation

title = {nhdplusTools: Tools for Accessing and Working with the NHDPlus}, publisher = {U.S. Geological Survey}, address = {Reston, VA}, - version = {1.4.0}, + version = {1.5.0}, institution = {U.S. Geological Survey}, year = {2025}, url = {https://doi.org/10.5066/P97AS8JD}, diff --git a/docs/index.html b/docs/index.html index 6deae3c1..a3297215 100644 --- a/docs/index.html +++ b/docs/index.html @@ -39,7 +39,7 @@ nhdplusTools - 1.5.0.9000 + 1.5.0 @@ -83,6 +83,15 @@

R-CMD-checkcodecov CRAN Downloads CRAN

+

Renaming to hydrogeofetch + +

+

nhdplusTools is being renamed to hydrogeofetch (hydrologic geospatial fabric extraction tool chain). The package’s scope has grown beyond NHDPlus, and the name is no longer accurate. hydrogeofetch will be a pure rename. Functions, function signatures, behavior, will all stay the same. hydrogeofetch will be published to CRAN as a new package.

+

Development on nhdplusTools has stopped; only critical bug fixes will be applied. Once hydrogeofetch v1.0 is released, nhdplusTools will become a deprecation shim that forwards calls to hydrogeofetch with a deprecation warnings. The shim will remain on CRAN until October 2028, at which point nhdplusTools will be archived. Archived packages stay installable from the CRAN archive, so code pinned to nhdplusTools will continue to run.

+

Plan to switch to hydrogeofetch once v1.0 is available.

+

Follow this repository to keep up to date!

+
+

nhdplusTools: Tools for Accessing and Working with the NHDPlus and other US hydrographic data.

@@ -239,10 +248,7 @@

Contributing:

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.

-

From: https://www.usgs.gov/office-of-science-quality-and-integrity/fundamental-science-practices#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

-

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.”

+

This software is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The software has not received final approval by the U.S. Geological Survey (USGS). 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. The software 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 software.

CC0

diff --git a/docs/news/index.html b/docs/news/index.html index 8e5af259..cbe8b1cb 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ nhdplusTools - 1.5.0.9000 + 1.5.0
@@ -55,6 +55,7 @@

Changelog

+

nhdplusTools 1.5.0 will be the last minor release of nhdplusTools before the package is renamed. Path releases may occur to fix minor issues or change things necessary for the name change, but the API is effectively frozen and all new development will go toward the replacement package hydrogeofetch. For more, see the README.md.

This release adds drainage area estimation tooling that combines HUC12 areas with NHDPlusV2 catchments to produce drainage area estimates at arbitrary points on the network.

@@ -270,7 +270,6 @@

Examples

#> Distance to outlet: 110 m (threshold 100 m => split needed) #> Finding HUC12 pour points upstream via NLDI... #> Fetching flowline attributes for 70 upstream COMIDs... -#> Request failed [504]. Retrying in 7.1 seconds... #> 70 flowlines, totdasqkm = 114.34 #> Found 1 HUC12 outlets #> Finding immediately-upstream HUC12 outlets... @@ -283,7 +282,6 @@

Examples

#> Splitting outlet catchment at gage point... #> Outlet split: full=1.07 km2, upstream=1.05 km2, removed=0.01 km2 #> Fetching extra catchment geometries... -#> Request failed [504]. Retrying in 9.5 seconds... #> HUC12 DA = 118.03, contributing = 118.03 #> Network DA = 114.34 #> Computing NHDPlusHR drainage area estimate... diff --git a/docs/reference/index.html b/docs/reference/index.html index 64ce2759..be3b3765 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -17,7 +17,7 @@ nhdplusTools - 1.5.0.9000 + 1.5.0 diff --git a/inst/build/build_vignettes.R b/inst/build/build_vignettes.R new file mode 100644 index 00000000..21ee220a --- /dev/null +++ b/inst/build/build_vignettes.R @@ -0,0 +1,32 @@ +if(!dir.exists("inst/doc")) dir.create("inst/doc", recursive = TRUE) + +Sys.setenv(BUILD_VIGNETTES = "TRUE", BUILD_VIGNETTES_CRAN = "TRUE") + +build_one <- function(name) { + src <- file.path("vignettes", paste0(name, ".Rmd")) + html <- file.path("inst/doc", paste0(name, ".html")) + if(file.exists(html) && file.mtime(html) >= file.mtime(src)) { + message("Skipping ", name, " (up to date)") + return(invisible()) + } + message("Building ", name, "...") + tryCatch({ + out <- suppressWarnings(rmarkdown::render(src, quiet = TRUE)) + file.rename(out, html) + knitr::purl(src, output = file.path("inst/doc", paste0(name, ".R"))) + file.copy(src, "inst/doc/", overwrite = TRUE) + message(" done.") + }, error = function(e) { + message(" FAILED: ", conditionMessage(e)) + }) +} + +build_one("drainage_area_estimation") +build_one("get_3dhp_data") +build_one("get_data_overview") +build_one("indexing") +build_one("nhdplusTools") +build_one("nhdplushr") +build_one("plot_nhdplus") + +message('Run devtools::check(build_args = "--no-build-vignettes") or devtools::release(pkg = ".", args = c("--no-build-vignettes", "--no-resave-data"))') diff --git a/vignettes/drainage_area_estimation.Rmd b/vignettes/drainage_area_estimation.Rmd index 9001498b..b2affb20 100644 --- a/vignettes/drainage_area_estimation.Rmd +++ b/vignettes/drainage_area_estimation.Rmd @@ -32,8 +32,12 @@ img { ```{r setup, include = FALSE} library(nhdplusTools) +#pkgdown build uses this build_local <- (Sys.getenv("BUILD_VIGNETTES") == "TRUE") +#cran package uses this +cran_build <- (Sys.getenv("BUILD_VIGNETTES_CRAN") == "TRUE") + knitr::opts_chunk$set( collapse = TRUE, comment = "#>", @@ -41,13 +45,13 @@ knitr::opts_chunk$set( fig.height = 7, dpi = 150, out.width = "100%", - eval = build_local, + eval = build_local && !cran_build, fig.path = "drainage_area_figures/" ) huc12 <- NULL wbd_gdb <- "../../Data/final_wbd/WBD_National_GDB/WBD_National_GDB.gdb" -if(file.exists(wbd_gdb)) { +if(file.exists(wbd_gdb) & !cran_build) { huc12 <- sf::read_sf(wbd_gdb, "WBDHU12") # Rename columns to the schema expected by # get_drainage_area_estimates() and the vignette plot helpers. @@ -88,6 +92,9 @@ has_davidson <- FALSE oldoption <- options(scipen = 9999) ``` +*A fully rendered version of this vignette with figures is available at +.* + `get_drainage_area_estimates()` combines Watershed Boundary Dataset (WBD) delineations and non-surface-contributing area estimates with National Hydrography Dataset Plus version 2 (NHDPlusV2) catchment