Skip to content

Commit

Permalink
Merge pull request #383 from DOI-USGS/380
Browse files Browse the repository at this point in the history
Check if names supporting checking terminals exist.
  • Loading branch information
dblodgett-usgs authored May 9, 2024
2 parents 1eb96f9 + eb1fd31 commit 469a4d6
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 5 deletions.
File renamed without changes.
15 changes: 13 additions & 2 deletions R/get_nhdplushr.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,19 @@ get_nhdplushr <- function(hr_dir, out_gpkg = NULL,
try(out <- st_sf(out))
}

if(grepl("flowline", layer, ignore.case = TRUE) & check_terminals)
out <- make_standalone(out)
if(grepl("flowline", layer, ignore.case = TRUE) & check_terminals) {
expect_names <- get(paste0("make_standalone_tonode_attributes"),
envir = nhdplusTools_env)
if(!all(expect_names %in% names(out))) {
warning("check_terminals is true but attributes selected do not support the checks.")
} else {
tryCatch(out <- make_standalone(out),
error = function(e) {
warning("Failed to execute 'make_standalone' on output.\n",
"Error was:\n", e)
})
}
}

if(!is.null(out_gpkg) && (!layer %in% layer_names | overwrite)) {
write_sf(out, layer = layer, dsn = out_gpkg)
Expand Down
45 changes: 42 additions & 3 deletions code.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,43 @@
[
{
"name": "nhdplusTools",
"organization": "U.S. Geological Survey",
"description": "Tools for Using NHDPlus Data",
"version": "v1.0.0",
"status": "Production",
"permissions": {
"usageType": "openSource",
"licenses": [
{
"name": "Public Domain, CC0-1.0",
"URL": "https://code.usgs.gov/water/nhdplusTools/-/raw/v1.0.0/LICENSE"
}
]
},
"homepageURL": "https://code.usgs.gov/water/nhdplusTools/",
"downloadURL": "https://code.usgs.gov/water/nhdplusTools/-/archive/v1.0.0/nhdplustools-v1.0.0.zip",
"disclaimerURL": "https://code.usgs.gov/water/nhdplusTools/-/raw/v1.0.0/DISCLAIMER.md",
"repositoryURL": "https://code.usgs.gov/water/nhdplusTools.git",
"vcs": "git",
"laborHours": 1500,
"tags": [
"R",
"nhdplus",
"USGS",
"water",
"v0.6.2"
],
"languages": [
"R"
],
"contact": {
"name": "David Blodgett",
"email": "[email protected]"
},
"date": {
"metadataLastUpdated": "2024-05-09"
}
},
{
"name": "nhdplusTools",
"organization": "U.S. Geological Survey",
Expand All @@ -10,7 +49,7 @@
"licenses": [
{
"name": "Public Domain, CC0-1.0",
"URL": "https://code.usgs.gov/water/nhdplusTools/-/raw/v0.6.1/LICENSE.md"
"URL": "https://code.usgs.gov/water/nhdplusTools/-/raw/v0.6.1/LICENSE"
}
]
},
Expand Down Expand Up @@ -49,7 +88,7 @@
"licenses": [
{
"name": "Public Domain, CC0-1.0",
"URL": "https://code.usgs.gov/water/nhdplusTools/-/raw/v0.6.1/LICENSE.md"
"URL": "https://code.usgs.gov/water/nhdplusTools/-/raw/v0.6.1/LICENSE"
}
]
},
Expand Down Expand Up @@ -87,7 +126,7 @@
"licenses": [
{
"name": "Public Domain, CC0-1.0",
"URL": "https://code.usgs.gov/water/nhdplusTools/-/raw/v0.6.0/LICENSE.md"
"URL": "https://code.usgs.gov/water/nhdplusTools/-/raw/v0.6.0/LICENSE"
}
]
},
Expand Down

0 comments on commit 469a4d6

Please sign in to comment.