Skip to content

Commit

Permalink
Merge pull request #369 from dblodgett-usgs/urls
Browse files Browse the repository at this point in the history
Urls and nhdplustools dir
  • Loading branch information
dblodgett-usgs authored Dec 8, 2023
2 parents 02c4889 + f972c38 commit a739a28
Show file tree
Hide file tree
Showing 134 changed files with 732 additions and 441 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
nhdplusTools 1.0.1
==========

- fixed nhd and nhdplushr urls #368
- fix issue with nhdplusTools_data_dir() #365
- fixed bug with large nhdplus downloads with empty tiles. #361

nhdplusTools 1.0.0
Expand Down
17 changes: 12 additions & 5 deletions R/A_nhdplusTools.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,12 @@ default_nhdplus_path <- "../NHDPlusV21_National_Seamless.gdb"
assign("default_nhdplus_path", default_nhdplus_path, envir = nhdplusTools_env)

nhd_bucket <- "https://prd-tnm.s3.amazonaws.com/"
nhdhr_file_list <- "?prefix=StagedProducts/Hydrography/NHDPlusHR/Beta/GDB/"
nhdhr_file_list <- "?prefix=StagedProducts/Hydrography/NHDPlusHR/VPU/Current/GDB/"
nhd_file_list <- "?prefix=StagedProducts/Hydrography/NHD/HU4/GDB/"

assign("nhd_bucket", nhd_bucket, envir = nhdplusTools_env)
assign("nhdhr_file_list", nhdhr_file_list, envir = nhdplusTools_env)

assign("nhdpt_dat_dir",
tools::R_user_dir("nhdplusTools"),
envir = nhdplusTools_env)

assign("nldi_tier", "prod",
envir = nhdplusTools_env)

Expand Down Expand Up @@ -298,7 +294,18 @@ get_nldi_url <- function() {
nhdplusTools_data_dir <- function(dir = NULL) {

if(is.null(dir)) {

nhdpt_dat_dir <- try(get("nhdpt_dat_dir", envir = nhdplusTools_env), silent = TRUE)

if(inherits(nhdpt_dat_dir, "try-error")) {
assign("nhdpt_dat_dir",
tools::R_user_dir("nhdplusTools"),
envir = nhdplusTools_env)
}

return(get("nhdpt_dat_dir", envir = nhdplusTools_env))


} else {
assign("nhdpt_dat_dir",
dir,
Expand Down
4 changes: 2 additions & 2 deletions R/downloading_tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ download_nhd_internal <- function(bucket, file_list_snip, prefix, nhd_dir, hu_li
#' download_nhdplusV2("./data/nhd/")
#'
#' download_nhdplusv2(outdir = "./inst/",
#' url = paste0("https://edap-ow-data-commons.s3.amazonaws.com/NHDPlusV21/",
#' url = paste0("https://dmap-data-commons-ow.s3.amazonaws.com/NHDPlusV21/",
#' "Data/NationalData/NHDPlusV21_NationalData_Seamless",
#' "_Geodatabase_HI_PR_VI_PI_03.7z"))
#' }

download_nhdplusv2 <- function(outdir,
url = paste0("https://edap-ow-data-commons.s3.amazonaws.com/NHDPlusV21/",
url = paste0("https://dmap-data-commons-ow.s3.amazonaws.com/NHDPlusV21/",
"Data/NationalData/NHDPlusV21_NationalData_Seamless",
"_Geodatabase_Lower48_07.7z"),
progress = TRUE) {
Expand Down
2 changes: 1 addition & 1 deletion data-raw/build_boundary_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ library(archive)
library(rmapshaper)
library(nhdplusTools)

epa_path <- "https://edap-ow-data-commons.s3.amazonaws.com/NHDPlusV21/Data/GlobalData/NHDPlusV21_NHDPlusGlobalData_03.7z"
epa_path <- "https://dmap-data-commons-ow.s3.amazonaws.com/NHDPlusV21/Data/GlobalData/NHDPlusV21_NHDPlusGlobalData_03.7z"
zip <- file.path("data/nhdglobal.7z")

GET(epa_path, write_disk(zip))
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

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

2 changes: 1 addition & 1 deletion docs/DISCLAIMER.html

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

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

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

2 changes: 1 addition & 1 deletion docs/articles/index.html

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

3 changes: 2 additions & 1 deletion docs/articles/indexing.html

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

19 changes: 8 additions & 11 deletions docs/articles/nhdplusTools.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.
Binary file modified docs/articles/nhdplusTools_files/figure-html/tldr2-1.png
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 a739a28

Please sign in to comment.