Skip to content

Commit

Permalink
Merge pull request #387 from DOI-USGS/memoise-bug
Browse files Browse the repository at this point in the history
Memoise bug
  • Loading branch information
dblodgett-usgs authored May 20, 2024
2 parents a69653a + 6b18b97 commit e51d404
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ variables:
_R_CHECK_CRAN_INCOMING_: "false"
_R_CHECK_FORCE_SUGGESTS_: "true"
_R_CHECK_DONTTEST_EXAMPLES_: "false"
APT_PKGS: "libudunits2-dev libgdal-dev libgeos-dev libproj-dev libcurl4-openssl-dev libssh2-1-dev libssl-dev libxml2-dev zlib1g-dev git p7zip-full"
APT_PKGS: "p7zip-full"

before_script:
- wget --no-check-certificate -O /usr/local/share/ca-certificates/DOIRootCA2.crt https://raw.githubusercontent.com/dblodgett-usgs/hydrogeoenv/master/linux/DOIRootCA2.cer
Expand All @@ -19,7 +19,7 @@ test:
stage: test
tags:
- chs-shared
image: code.chs.usgs.gov:5001/wma/hydrogeoenv:rocker-geospatial
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/rocker/geospatial:latest
script:
- r -e 'devtools::check(check_dir = ".")'
- r -e 'capture.output(print(covr::coverage_to_list(covr::package_coverage(type = "all")), width = 20), file = "covr.txt", split = TRUE)'
Expand Down
12 changes: 7 additions & 5 deletions R/A_nhdplusTools.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ assign("geoserver_root", "https://labs.waterdata.usgs.gov/geoserver/",
assign("arcrest_root", "https://hydro.nationalmap.gov/arcgis/rest/services/",
envir = nhdplusTools_env)

assign("gocnx_ref_base_url", "https://reference.geoconnex.us/",
envir = nhdplusTools_env)

assign("split_flowlines_attributes",
c("COMID", "toCOMID", "LENGTHKM"),
envir = nhdplusTools_env)
Expand Down Expand Up @@ -370,8 +373,10 @@ nhdplus_path <- function(path = NULL, warn = FALSE) {
#' @export
#'
nhdplusTools_cache_settings <- function(mode = NULL, timeout = NULL) {
current_mode <- get("nhdpt_mem_cache", envir = nhdplusTools_env)
current_timeout <- get("nhdpt_cache_timeout", envir = nhdplusTools_env)
current_mode <- tryCatch(get("nhdpt_mem_cache", envir = nhdplusTools_env),
error = \(e) "filesystem") # default to filesystem
current_timeout <- tryCatch(get("nhdpt_cache_timeout", envir = nhdplusTools_env),
error = \(e) nhdplusTools_memoise_timeout())

if(!is.null(mode) && mode %in% c("memory", "filesystem")) {
assign("nhdpt_mem_cache", mode, envir = nhdplusTools_env)
Expand Down Expand Up @@ -423,9 +428,6 @@ nhdplusTools_memoise_timeout <- function() {
}
}

assign("nhdpt_mem_cache", nhdplusTools_memoise_cache(), envir = nhdplusTools_env)
assign("nhdpt_cache_timeout", nhdplusTools_memoise_timeout(), envir = nhdplusTools_env)

#' @title Align NHD Dataset Names
#' @description this function takes any NHDPlus dataset and aligns the attribute names with those used in nhdplusTools.
#' @param x a \code{sf} object of nhdplus flowlines
Expand Down

0 comments on commit e51d404

Please sign in to comment.