Skip to content

Commit

Permalink
Merge pull request #423 from DOI-USGS/update
Browse files Browse the repository at this point in the history
v1.3.1
  • Loading branch information
dblodgett-usgs authored Feb 19, 2025
2 parents b525383 + 0faff41 commit b1d1185
Show file tree
Hide file tree
Showing 135 changed files with 9,770 additions and 707 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Description: Tools for traversing and working with National Hydrography Dataset
URL: https://doi-usgs.github.io/nhdplusTools/ https://github.com/doi-usgs/nhdplusTools/
BugReports: https://github.com/doi-usgs/nhdplusTools/issues/
Depends:
R (>= 4.0)
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
License: CC0
Expand Down
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export(calculate_total_drainage_area)
export(disambiguate_flowline_indexes)
export(discover_geoconnex_reference)
export(discover_nhdplus_id)
export(discover_nldi_characteristics)
export(download_nhd)
export(download_nhdplushr)
export(download_nhdplusv2)
Expand Down Expand Up @@ -36,7 +35,6 @@ export(get_nhdphr)
export(get_nhdplus)
export(get_nhdplushr)
export(get_nldi_basin)
export(get_nldi_characteristics)
export(get_nldi_feature)
export(get_nldi_index)
export(get_node)
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
nhdplusTools 1.3.1
==========

- added a web service client for the NHDPlusHR argis server `get_nhdphr()`. #415
- added a web service client for the NHDPlusHR arcgis server `get_nhdphr()`. #415
- removed deprecated discover_nldi_characteristics() and get_nldi_characteristics()

nhdplusTools 1.3.0
==========
Expand Down
3 changes: 2 additions & 1 deletion R/downloading_tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
#' \donttest{
#' hu <- get_huc(sf::st_sfc(sf::st_point(c(-73, 42)), crs = 4326),
#' type = "huc08")
#'
#' if(inherits(hu, "sf")) {
#' (hu <- substr(hu$huc8, 1, 2))
#'
#' download_nhdplushr(tempdir(), c(hu, "0203"), download_files = FALSE)
#'
#' download_nhdplushr(tempdir(), c(hu, "0203"), download_files = FALSE, archive = TRUE)
#' }
#' }
download_nhdplushr <- function(nhd_dir, hu_list, download_files = TRUE, archive = FALSE) {

list_source <- get("nhdhr_file_list", envir = nhdplusTools_env)
Expand Down
2 changes: 1 addition & 1 deletion R/get_hydro.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#'
#' See <doi:10.5066/P92U7ZUT> for full source data.
#'
#' See https://api.water.usgs.gov/geoserver/web/ for the web service.
#' See https://api.water.usgs.gov/ (geoserver) for the web service.
#'
#' `huc12_nhdplusv2` derives from a snapshot of the WBD available from the nhdplusv2.
#' See \link{download_nhdplusv2} for source data documentation.
Expand Down
78 changes: 0 additions & 78 deletions R/get_nldi.R
Original file line number Diff line number Diff line change
@@ -1,50 +1,3 @@
#' @title (DEPRECATED) Discover Characteristics Metadata
#' @description
#'
#' This functionality is deprecated and will be removed in the near future.
#'
#' Please use \link{get_characteristics_metadata} instead.
#'
#' @param type character "all", "local", "total", or "divergence_routed".
#' @export
#' @return data.frame containing available characteristics
#'
discover_nldi_characteristics <- function(type="all") {

tc <- type_check(type)

out <- lapply(tc$type_options[[type]], function(x) {
o <- query_nldi(paste0(x, "/characteristics"),
base_path = "/lookups")

if(is.null(o)) {
return(NULL)
}

o$characteristicMetadata$characteristic

})

names(out) <- tc$char_names

out
}

type_check <- function(type) {
type_options <- list("all" = c("local", "tot", "div"),
"local" = "local",
"total" = "tot",
"divergence_routed" = "div")

if(!type %in% names(type_options)) stop(paste("Type must be one of", paste(names(type_options), collapse = ", ")))

char_names <- type

if(type == "all") char_names <- names(type_options)[2:4]

return(list(type_options = type_options, char_names = char_names))
}

#' @title Navigate NLDI
#' @description Navigate the Network Linked Data Index network.
#' @param nldi_feature list with names `featureSource` and `featureID` where
Expand Down Expand Up @@ -214,37 +167,6 @@ get_nldi_feature <- function(nldi_feature) {
return(out$origin)
}

#' @title (DEPRECATED) Get Catchment Characteristics
#' @description
#'
#' This functionality id deprecated and will be removed in the near future.
#'
#' Please use \link{get_catchment_characteristics} instead.
#'
#' @inheritParams navigate_nldi
#' @inheritParams discover_nldi_characteristics
#' @return data.frame containing requested characteristics
#' @export
get_nldi_characteristics <- function(nldi_feature, type="local") {

tc <- type_check(type)

nldi_feature <- check_nldi_feature(nldi_feature, convert = FALSE)

out <- lapply(tc$type_options[[type]], function(x) {
o <- query_nldi(paste(nldi_feature[["featureSource"]],
nldi_feature[["featureID"]],
x,
sep = "/"))
o$characteristics
})

names(out) <- tc$char_names

out

}

#' Get NLDI Index
#' @description uses the Network Linked Data Index to retrieve and estimated
#' network location for the given point. If not within a grid cell of a flowline,
Expand Down
2 changes: 0 additions & 2 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ reference:
- '`get_nhdarea`'
- '`get_waterbodies`'
- '`get_nwis`'
- '`discover_nldi_characteristics`'
- '`get_nldi_characteristics`'
- '`get_nldi_basin`'
- '`get_nldi_feature`'
- '`get_split_catchment`'
Expand Down
41 changes: 35 additions & 6 deletions docs/articles/get_3dhp_data.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b1d1185

Please sign in to comment.