Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memoise bug #387

Merged
merged 3 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading