diff --git a/DESCRIPTION b/DESCRIPTION index f4882dd..ac24f3d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rosettaPTF Title: R Frontend for Rosetta Pedotransfer Functions -Version: 0.1.4 +Version: 0.1.5 Author: Soil and Plant Science Division Staff Maintainer: Andrew G. Brown Description: Access Python rosetta-soil pedotransfer functions in an R environment. Rosetta is a neural network-based model for predicting unsaturated soil hydraulic parameters from basic soil characterization data. The model predicts parameters for the van Genuchten unsaturated soil hydraulic properties model, using sand, silt, and clay, bulk density and water content. The codebase is now maintained by Dr. Todd Skaggs and other U.S. Department of Agriculture employees. This R package is intended to provide for use cases that involve many thousands of calls to the pedotransfer function. Less demanding use cases are encouraged to use the web interface or API endpoint. There are additional wrappers of the API endpoints provided by the soilDB R package `ROSETTA()` method. diff --git a/NEWS.md b/NEWS.md index 8ae0529..e143a61 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,15 @@ +# rosettaPTF 0.1.5 + +* Fix check logic for whether input SpatRaster is in memory + +# rosettaPTF 0.1.4 + +* Added arguments to `install_rosetta()` + + * `system` argument for installing to user site packages with `--user` flag + + * `upgrade` argument for forcing upgrade of rosetta-soil module + # rosettaPTF 0.1.3 * Fixes for recent changes in {reticulate} (>= 1.29) diff --git a/R/find_python.R b/R/find_python.R index 27ebd9d..e3117c1 100644 --- a/R/find_python.R +++ b/R/find_python.R @@ -45,7 +45,7 @@ find_python <- function(envname = NULL, } if (is.null(pypath_before)) { - pypath <- try(.find_python(envname = envname, pypath = pypath_before, arcpy_path = arcpy_path)) + pypath <- try(.find_python(envname = envname, pypath = pypath_before, arcpy_path = arcpy_path), silent = TRUE) if (!inherits(pypath, 'try-error')) { options(rosettaPTF.python_path = pypath) @@ -77,7 +77,7 @@ find_python <- function(envname = NULL, y }) idx <- which.max(order(as.character(xxx))) - res <- try(reticulate::use_python(x$python_versions[idx])) + res <- try(reticulate::use_python(x$python_versions[idx]), silent = TRUE) } # otherwise find newest python installation @@ -90,7 +90,7 @@ find_python <- function(envname = NULL, y }) idx <- which.max(order(as.character(xxx))) - res <- try(reticulate::use_python(x$python_versions[idx])) + res <- try(reticulate::use_python(x$python_versions[idx]), silent = TRUE) } } } @@ -134,6 +134,6 @@ find_python <- function(envname = NULL, stop(res, call. = FALSE) } - try(reticulate::py_config()) + try(reticulate::py_config(), silent = TRUE) res } diff --git a/R/run_rosetta.R b/R/run_rosetta.R index 6a87a2a..c166845 100644 --- a/R/run_rosetta.R +++ b/R/run_rosetta.R @@ -186,7 +186,7 @@ run_rosetta.SpatRaster <- function(soildata, nrows = nrow(soildata) / (terra::ncell(soildata) / core_thresh), overwrite = TRUE) { - if (!terra::inMemory(soildata)) { + if (any(!terra::inMemory(soildata))) { terra::readStart(soildata) on.exit({ try({ @@ -227,7 +227,7 @@ run_rosetta.SpatRaster <- function(soildata, # parallel within-block processing n <- floor(length(ids) / core_thresh / cores) + 1 - X <- split(blockdata, rep(seq(from = 1, to = n, each = n)))[1:length(ids)] + X <- split(blockdata, rep(seq(from = 1, to = n)))[1:length(ids)] r <- do.call('rbind', parallel::clusterApply(cls, X, function(x) rosettaPTF::run_rosetta(x, vars = vars, rosetta_version = rosetta_version)))