Unverified Commit 6acfcd66 authored by Laura A DeCicco's avatar Laura A DeCicco Committed by GitHub
Browse files

Merge pull request #531 from dblodgett-usgs/master

quiet requireNamespace check and move web service call into findNLDI
parents f6bad1dd 7e1fff9d
...@@ -3,6 +3,5 @@ pkg.env <- new.env() ...@@ -3,6 +3,5 @@ pkg.env <- new.env()
.onLoad = function(libname, pkgname){ .onLoad = function(libname, pkgname){
suppressMessages(setAccess('public')) suppressMessages(setAccess('public'))
pkg.env$nldi_base <- "https://labs.waterdata.usgs.gov/api/nldi/linked-data/" pkg.env$nldi_base <- "https://labs.waterdata.usgs.gov/api/nldi/linked-data/"
pkg.env$local_sf <- requireNamespace("sf") pkg.env$local_sf <- requireNamespace("sf", quietly = TRUE)
pkg.env$current_nldi <- get_nldi_sources()
} }
...@@ -262,7 +262,7 @@ findNLDI <- function(comid = NULL, ...@@ -262,7 +262,7 @@ findNLDI <- function(comid = NULL,
# Should sf be used? Both no_sf and pkg.env must agree # Should sf be used? Both no_sf and pkg.env must agree
use_sf = all(pkg.env$local_sf, !no_sf) use_sf = all(pkg.env$local_sf, !no_sf)
# Should the basin be identified? # Should the basin be identified?
getBasin = ("basin" %in% find) getBasin = ("basin" %in% find)
...@@ -319,6 +319,10 @@ findNLDI <- function(comid = NULL, ...@@ -319,6 +319,10 @@ findNLDI <- function(comid = NULL,
# Reset (if needed) # Reset (if needed)
start_type = names(starter) start_type = names(starter)
if(is.null(pkg.env$current_nldi)) {
pkg.env$current_nldi <- get_nldi_sources()
}
# Defining the origin URL. # Defining the origin URL.
# Align request with formal name from offerings # Align request with formal name from offerings
# If NWIS, add "USGS-" prefix # If NWIS, add "USGS-" prefix
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment