From 165ce38a04c8e882cb4439d1e38458cde643812a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Thu, 4 May 2023 10:02:46 +0200 Subject: [PATCH 01/10] compare copy to writeRaster --- R/cachePut.R | 48 ++++++++++++++++++++++++++++++----- tests/testthat/test-caching.R | 16 ++++-------- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/R/cachePut.R b/R/cachePut.R index 8a968cd3..35fca3ab 100644 --- a/R/cachePut.R +++ b/R/cachePut.R @@ -58,7 +58,47 @@ toolTerraToCache <- function(x, name, fname) { return(terra::wrap(x)) } - # copy all source files into the cache + # write gpkg/tif to cache, then re-create SpatVector/SpatRaster referencing this new cache file + if (inherits(x, "SpatVector")) { + sourceFile <- paste0(file_path_sans_ext(fname), "-", name, ".gpkg") + if (file.exists(sourceFile)) { + message("Not writing ", sourceFile, " because it already exists.") + } else { + cat("copyTerraSources\n") + print(system.time({ + copyTerraSources(x, name, fname) + })) + unlink(sourceFile) + cat("writeVector\n") + print(system.time({ + terra::writeVector(x, sourceFile) + })) + } + out <- terra::vect(sourceFile) + return(terra::wrap(out)) + } else if (inherits(x, "SpatRaster")) { + sourceFile <- paste0(file_path_sans_ext(fname), "-", name, ".tif") + if (file.exists(sourceFile)) { + message("Not writing ", sourceFile, " because it already exists.") + } else { + cat("copyTerraSources\n") + print(system.time({ + copyTerraSources(x, name, fname) + })) + unlink(sourceFile) + cat("writeRaster\n") + print(system.time({ + terra::writeRaster(x, sourceFile) + })) + } + out <- terra::rast(sourceFile) + return(terra::wrap(out, proxy = TRUE)) + } else { + stop("madrat:::toolTerraToCache supports only SpatVector and SpatRaster") + } +} + +copyTerraSources <- function(x, name, fname) { sources <- terra::sources(x) if ("" %in% sources) { stop("file-based and in-memory parts in the same terra object can currently not be cached") @@ -84,10 +124,4 @@ toolTerraToCache <- function(x, name, fname) { } } } - stopifnot(identical(intersect(sources, terra::sources(x)), character(0))) - - # re-create x using sources copied to the cache - out <- if (inherits(x, "SpatVector")) terra::vect(sources) else terra::rast(sources) - names(out) <- names(x) - return(terra::wrap(out)) } diff --git a/tests/testthat/test-caching.R b/tests/testthat/test-caching.R index 96352e6f..431d9f8b 100644 --- a/tests/testthat/test-caching.R +++ b/tests/testthat/test-caching.R @@ -113,6 +113,8 @@ test_that("terra objects can be cached", { readSingleSource <- function() { x <- terra::rast(system.file("ex/meuse.tif", package = "terra")) names(x) <- "something" + terra::units(x) <- "some unit" + terra::time(x) <- 1234 return(list(x = x, class = "SpatRaster")) } globalassign("downloadSingleSource", "readSingleSource") @@ -120,8 +122,10 @@ test_that("terra objects can be cached", { expect_message(b <- readSource("SingleSource"), "loading cache") # converting to data frame because terra::sources is different expect_equal(terra::as.data.frame(a, xy = TRUE), - terra::as.data.frame(b, xy = TRUE)) + terra::as.data.frame(b, xy = TRUE)) expect_identical(names(a), names(b)) + expect_identical(terra::units(a), terra::units(b)) + expect_equal(terra::time(a), terra::time(b)) downloadInMemory <- function() { @@ -160,16 +164,6 @@ test_that("terra objects can be cached", { expect_identical(names(a), names(b)) - readMultiSource <- function() { - a <- terra::rast(system.file("ex/meuse.tif", package = "terra")) - a <- c(a, a * 2) # one SpatRaster from source file, one in-memory - return(list(x = a, class = "SpatRaster")) - } - globalassign("readMultiSource") - expect_error(readSource("MultiSource"), - "file-based and in-memory parts in the same terra object can currently not be cached") - - downloadSpatVector <- function() { return(list(url = 0, author = 0, title = 0, license = 0, description = 0, unit = 0)) } From fd05692fd943fe767307257fd73c668e039fd957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Thu, 4 May 2023 10:07:46 +0200 Subject: [PATCH 02/10] reset to copy approach --- R/cachePut.R | 54 +++++++++++++--------------------------------------- 1 file changed, 13 insertions(+), 41 deletions(-) diff --git a/R/cachePut.R b/R/cachePut.R index 35fca3ab..6eb2e036 100644 --- a/R/cachePut.R +++ b/R/cachePut.R @@ -58,47 +58,7 @@ toolTerraToCache <- function(x, name, fname) { return(terra::wrap(x)) } - # write gpkg/tif to cache, then re-create SpatVector/SpatRaster referencing this new cache file - if (inherits(x, "SpatVector")) { - sourceFile <- paste0(file_path_sans_ext(fname), "-", name, ".gpkg") - if (file.exists(sourceFile)) { - message("Not writing ", sourceFile, " because it already exists.") - } else { - cat("copyTerraSources\n") - print(system.time({ - copyTerraSources(x, name, fname) - })) - unlink(sourceFile) - cat("writeVector\n") - print(system.time({ - terra::writeVector(x, sourceFile) - })) - } - out <- terra::vect(sourceFile) - return(terra::wrap(out)) - } else if (inherits(x, "SpatRaster")) { - sourceFile <- paste0(file_path_sans_ext(fname), "-", name, ".tif") - if (file.exists(sourceFile)) { - message("Not writing ", sourceFile, " because it already exists.") - } else { - cat("copyTerraSources\n") - print(system.time({ - copyTerraSources(x, name, fname) - })) - unlink(sourceFile) - cat("writeRaster\n") - print(system.time({ - terra::writeRaster(x, sourceFile) - })) - } - out <- terra::rast(sourceFile) - return(terra::wrap(out, proxy = TRUE)) - } else { - stop("madrat:::toolTerraToCache supports only SpatVector and SpatRaster") - } -} - -copyTerraSources <- function(x, name, fname) { + # copy all source files into the cache sources <- terra::sources(x) if ("" %in% sources) { stop("file-based and in-memory parts in the same terra object can currently not be cached") @@ -124,4 +84,16 @@ copyTerraSources <- function(x, name, fname) { } } } + stopifnot(identical(intersect(sources, terra::sources(x)), character(0))) + + # re-create x using sources copied to the cache + if (inherits(x, "SpatVector")) { + out <- terra::vect(sources) + } else { + out <- terra::rast(sources) + terra::units(out) <- terra::units(x) + terra::time(out) <- terra::time(x) + } + names(out) <- names(x) + return(terra::wrap(out)) } From 6e8d5e6bedff9325bf911d396c9a483ea4a05713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Thu, 4 May 2023 10:12:03 +0200 Subject: [PATCH 03/10] test formatting --- tests/testthat/test-caching.R | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/testthat/test-caching.R b/tests/testthat/test-caching.R index 431d9f8b..2500e386 100644 --- a/tests/testthat/test-caching.R +++ b/tests/testthat/test-caching.R @@ -142,7 +142,7 @@ test_that("terra objects can be cached", { expect_message(b <- readSource("InMemory"), "loading cache") # converting to data frame because terra::sources is different expect_equal(terra::as.data.frame(a, xy = TRUE), - terra::as.data.frame(b, xy = TRUE)) + terra::as.data.frame(b, xy = TRUE)) expect_identical(names(a), names(b)) @@ -151,7 +151,7 @@ test_that("terra objects can be cached", { } readMultiSource <- function() { a <- terra::rast(system.file("ex/meuse.tif", package = "terra")) - a <- c(a, a) # one SpatRaster from source file, one in-memory + a <- c(a, a) names(a) <- c("something", "else") return(list(x = a, class = "SpatRaster")) } @@ -160,7 +160,7 @@ test_that("terra objects can be cached", { expect_message(b <- readSource("MultiSource"), "loading cache") # converting to data frame because terra::sources is different expect_equal(terra::as.data.frame(a, xy = TRUE), - terra::as.data.frame(b, xy = TRUE)) + terra::as.data.frame(b, xy = TRUE)) expect_identical(names(a), names(b)) @@ -175,8 +175,8 @@ test_that("terra objects can be cached", { expect_message(a <- readSource("SpatVector"), "writing cache") expect_message(b <- readSource("SpatVector"), "loading cache") # converting to data frame because terra::sources is different - expect_identical(terra::as.data.frame(a, geom = "WKT"), - terra::as.data.frame(b, geom = "WKT")) + expect_equal(terra::as.data.frame(a, geom = "WKT"), + terra::as.data.frame(b, geom = "WKT")) expect_identical(names(a), names(b)) @@ -191,7 +191,7 @@ test_that("terra objects can be cached", { expect_message(a <- readSource("InMemoryVector"), "writing cache") expect_message(b <- readSource("InMemoryVector"), "loading cache") # converting to data frame because terra::sources is different - expect_identical(terra::as.data.frame(a, geom = "WKT"), - terra::as.data.frame(b, geom = "WKT")) + expect_equal(terra::as.data.frame(a, geom = "WKT"), + terra::as.data.frame(b, geom = "WKT")) expect_identical(names(a), names(b)) }) From 932df999fec56f718e7842c99f25ff30c739239d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Thu, 4 May 2023 10:31:18 +0200 Subject: [PATCH 04/10] re-add test --- tests/testthat/test-caching.R | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/testthat/test-caching.R b/tests/testthat/test-caching.R index 2500e386..720a6e33 100644 --- a/tests/testthat/test-caching.R +++ b/tests/testthat/test-caching.R @@ -163,6 +163,15 @@ test_that("terra objects can be cached", { terra::as.data.frame(b, xy = TRUE)) expect_identical(names(a), names(b)) + readMultiSource <- function() { + a <- terra::rast(system.file("ex/meuse.tif", package = "terra")) + a <- c(a, a * 2) # one SpatRaster from source file, one in-memory + return(list(x = a, class = "SpatRaster")) + } + globalassign("readMultiSource") + expect_error(readSource("MultiSource"), + "file-based and in-memory parts in the same terra object can currently not be cached") + downloadSpatVector <- function() { return(list(url = 0, author = 0, title = 0, license = 0, description = 0, unit = 0)) From 655f59808c84bba30784ec988017567d94ed882e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Thu, 4 May 2023 15:16:25 +0200 Subject: [PATCH 05/10] terra caching units, time, names --- R/cacheGet.R | 36 ++++++++++++++++++++++-------------- R/cachePut.R | 31 +++++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 22 deletions(-) diff --git a/R/cacheGet.R b/R/cacheGet.R index 079d26d6..e8527dc5 100644 --- a/R/cacheGet.R +++ b/R/cacheGet.R @@ -17,10 +17,25 @@ #' @importFrom digest digest cacheGet <- function(prefix, type, args = NULL, graph = NULL, ...) { - .spatRasterLoad <- function(x) { - if (!requireNamespace("terra", quietly = TRUE)) stop("Package `terra` required for caching of SpatRaster objects!") - out <- terra::rast(x$file) - names(out) <- x$names + .terraLoad <- function(xList) { + if (!requireNamespace("terra", quietly = TRUE)) { + stop("Package `terra` required for caching of SpatRaster objects!") + } + if (inherits(xList$x, c("PackedSpatRaster", "PackedSpatVector"))) { + out <- terra::unwrap(xList$x) + if (!is.null(xList$units)) { + terra::units(out) <- xList$units + } + if (!is.null(xList$time)) { + terra::time(out) <- xList$time + } + } else { + out <- terra::rast(xList$file) + } + + if (!is.null(xList$names)) { + names(out) <- xList$names + } return(out) } @@ -43,16 +58,9 @@ cacheGet <- function(prefix, type, args = NULL, graph = NULL, ...) { vcat(0, " - corrupt cache file ", basename(fname), "! Continue without cache.") return(NULL) } - if (is.list(x)) { - for (elem in c("x", "weight")) { - if (is.list(x[[elem]]) && identical(x[[elem]]$class, "SpatRaster")) { - x[[elem]] <- .spatRasterLoad(x[[elem]]) - } else if (inherits(x[[elem]], c("PackedSpatRaster", "PackedSpatVector"))) { - if (!requireNamespace("terra", quietly = TRUE)) { - stop("Package `terra` is required for reading SpatRaster/SpatVector objects from cache!") - } - x[[elem]] <- terra::unwrap(x[[elem]]) - } + if (is.list(x) && isTRUE(x$class %in% c("SpatRaster", "SpatVector"))) { + for (elem in intersect(names(x), c("x", "weight"))) { + x[[elem]] <- .terraLoad(x[[elem]]) } } attr(x, "id") <- fname diff --git a/R/cachePut.R b/R/cachePut.R index 6eb2e036..c68b9aef 100644 --- a/R/cachePut.R +++ b/R/cachePut.R @@ -55,16 +55,16 @@ toolTerraToCache <- function(x, name, fname) { stop("Package `terra` required for caching terra objects!") } if (all(terra::sources(x) == "")) { - return(terra::wrap(x)) + return(list(x = terra::wrap(x))) } - # copy all source files into the cache sources <- terra::sources(x) if ("" %in% sources) { stop("file-based and in-memory parts in the same terra object can currently not be cached") } # the regex deals with sources such as 'NETCDF:"/PIK/inputdata/sources/LUH2v2h/states.nc":primf' sourceFiles <- unique(gsub('^[^"]*"|"[^"]*$', "", sources)) + # copy all source files into the cache for (sourceFile in sourceFiles) { targetName <- paste0(file_path_sans_ext(fname), "-", name, ".", file_ext(sourceFile)) sources <- sub(sourceFile, targetName, sources, fixed = TRUE) @@ -86,14 +86,29 @@ toolTerraToCache <- function(x, name, fname) { } stopifnot(identical(intersect(sources, terra::sources(x)), character(0))) + out <- list() # re-create x using sources copied to the cache if (inherits(x, "SpatVector")) { - out <- terra::vect(sources) + x2 <- terra::vect(sources) + } else if (inherits(x, "SpatRaster")) { + x2 <- terra::rast(sources) + if (length(terra::units(x2)) == length(terra::units(x))) { + terra::units(x2) <- terra::units(x) + out$units <- terra::units(x) + } + if (length(terra::time(x2)) == length(terra::time(x))) { + terra::time(x2) <- terra::time(x) + out$time <- terra::time(x) + } } else { - out <- terra::rast(sources) - terra::units(out) <- terra::units(x) - terra::time(out) <- terra::time(x) + stop("Expected x to be SpatVector or SpatRaster") } - names(out) <- names(x) - return(terra::wrap(out)) + + if (length(names(x2)) == length(names(x))) { + names(x2) <- names(x) + out$names <- names(x) + } + + out$x <- terra::wrap(x2) + return(out) } From f8504d10c407e3577b95ab2b55da2fae59e8be1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Thu, 4 May 2023 15:30:27 +0200 Subject: [PATCH 06/10] formatting --- R/cacheGet.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/cacheGet.R b/R/cacheGet.R index e8527dc5..200c230e 100644 --- a/R/cacheGet.R +++ b/R/cacheGet.R @@ -19,8 +19,9 @@ cacheGet <- function(prefix, type, args = NULL, graph = NULL, ...) { .terraLoad <- function(xList) { if (!requireNamespace("terra", quietly = TRUE)) { - stop("Package `terra` required for caching of SpatRaster objects!") + stop("Package `terra` required for caching of terra objects!") } + if (inherits(xList$x, c("PackedSpatRaster", "PackedSpatVector"))) { out <- terra::unwrap(xList$x) if (!is.null(xList$units)) { @@ -36,6 +37,7 @@ cacheGet <- function(prefix, type, args = NULL, graph = NULL, ...) { if (!is.null(xList$names)) { names(out) <- xList$names } + return(out) } From 030208f0d74c9c5fdbf0ad5d821a09ebfa4edad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Thu, 4 May 2023 16:06:41 +0200 Subject: [PATCH 07/10] throw error if terra cannot be cached --- R/cachePut.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/cachePut.R b/R/cachePut.R index c68b9aef..99946d61 100644 --- a/R/cachePut.R +++ b/R/cachePut.R @@ -107,6 +107,9 @@ toolTerraToCache <- function(x, name, fname) { if (length(names(x2)) == length(names(x))) { names(x2) <- names(x) out$names <- names(x) + } else { + stop("Cannot cache this terra object, because loading it from cache would yield a different number of layers. ", + "Add `cache = FALSE` to the returned list to disable caching.") } out$x <- terra::wrap(x2) From ea8f17eb1cd17ba2c19695dcb23523e16ef4fe33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Thu, 4 May 2023 16:06:56 +0200 Subject: [PATCH 08/10] buildLibrary --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- README.md | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 00b6081a..07fb79e0 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '6426750' +ValidationKey: '6448211' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/CITATION.cff b/CITATION.cff index 0400cec1..33a22f00 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,8 +2,8 @@ cff-version: 1.2.0 message: If you use this software, please cite it using the metadata from this file. type: software title: 'madrat: May All Data be Reproducible and Transparent (MADRaT) *' -version: 3.3.0 -date-released: '2023-04-28' +version: 3.3.1 +date-released: '2023-05-04' abstract: Provides a framework which should improve reproducibility and transparency in data processing. It provides functionality such as automatic meta data creation and management, rudimentary quality management, data caching, work-flow management diff --git a/DESCRIPTION b/DESCRIPTION index 014dac5f..d00f5d43 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: madrat Title: May All Data be Reproducible and Transparent (MADRaT) * -Version: 3.3.0 -Date: 2023-04-28 +Version: 3.3.1 +Date: 2023-05-04 Authors@R: c( person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = c("aut", "cre")), person("Lavinia", "Baumstark", , "lavinia@pik-potsdam.de", role = "aut"), diff --git a/README.md b/README.md index 48bc3a3b..7b447830 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # May All Data be Reproducible and Transparent (MADRaT) * -R package **madrat**, version **3.3.0** +R package **madrat**, version **3.3.1** [![CRAN status](https://www.r-pkg.org/badges/version/madrat)](https://cran.r-project.org/package=madrat) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1115490.svg)](https://doi.org/10.5281/zenodo.1115490) [![R build status](https://github.com/pik-piam/madrat/workflows/check/badge.svg)](https://github.com/pik-piam/madrat/actions) [![codecov](https://codecov.io/gh/pik-piam/madrat/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/madrat) [![r-universe](https://pik-piam.r-universe.dev/badges/madrat)](https://pik-piam.r-universe.dev/builds) @@ -55,7 +55,7 @@ In case of questions / problems please contact Jan Philipp Dietrich , R package version 3.3.0, . +Dietrich J, Baumstark L, Wirth S, Giannousakis A, Rodrigues R, Bodirsky B, Kreidenweis U, Klein D, Führlich P (2023). _madrat: May All Data be Reproducible and Transparent (MADRaT)_. doi:10.5281/zenodo.1115490 , R package version 3.3.1, . A BibTeX entry for LaTeX users is @@ -64,7 +64,7 @@ A BibTeX entry for LaTeX users is title = {madrat: May All Data be Reproducible and Transparent (MADRaT)}, author = {Jan Philipp Dietrich and Lavinia Baumstark and Stephen Wirth and Anastasis Giannousakis and Renato Rodrigues and Benjamin Leon Bodirsky and Ulrich Kreidenweis and David Klein and Pascal Führlich}, year = {2023}, - note = {R package version 3.3.0}, + note = {R package version 3.3.1}, doi = {10.5281/zenodo.1115490}, url = {https://github.com/pik-piam/madrat}, } From 5d7ec8c509935700df93dbb0cf99c59172e8986d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Tue, 9 May 2023 14:37:16 +0200 Subject: [PATCH 09/10] simplify --- R/cacheGet.R | 18 ++++-------------- R/cachePut.R | 9 ++------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/R/cacheGet.R b/R/cacheGet.R index 200c230e..3e874b78 100644 --- a/R/cacheGet.R +++ b/R/cacheGet.R @@ -17,25 +17,15 @@ #' @importFrom digest digest cacheGet <- function(prefix, type, args = NULL, graph = NULL, ...) { - .terraLoad <- function(xList) { + .terraLoad <- function(x) { if (!requireNamespace("terra", quietly = TRUE)) { stop("Package `terra` required for caching of terra objects!") } - if (inherits(xList$x, c("PackedSpatRaster", "PackedSpatVector"))) { - out <- terra::unwrap(xList$x) - if (!is.null(xList$units)) { - terra::units(out) <- xList$units - } - if (!is.null(xList$time)) { - terra::time(out) <- xList$time - } + if (inherits(x, c("PackedSpatRaster", "PackedSpatVector"))) { + out <- terra::unwrap(x) } else { - out <- terra::rast(xList$file) - } - - if (!is.null(xList$names)) { - names(out) <- xList$names + out <- terra::rast(x$file) } return(out) diff --git a/R/cachePut.R b/R/cachePut.R index 99946d61..7385b30f 100644 --- a/R/cachePut.R +++ b/R/cachePut.R @@ -55,7 +55,7 @@ toolTerraToCache <- function(x, name, fname) { stop("Package `terra` required for caching terra objects!") } if (all(terra::sources(x) == "")) { - return(list(x = terra::wrap(x))) + return(terra::wrap(x)) } sources <- terra::sources(x) @@ -86,7 +86,6 @@ toolTerraToCache <- function(x, name, fname) { } stopifnot(identical(intersect(sources, terra::sources(x)), character(0))) - out <- list() # re-create x using sources copied to the cache if (inherits(x, "SpatVector")) { x2 <- terra::vect(sources) @@ -94,11 +93,9 @@ toolTerraToCache <- function(x, name, fname) { x2 <- terra::rast(sources) if (length(terra::units(x2)) == length(terra::units(x))) { terra::units(x2) <- terra::units(x) - out$units <- terra::units(x) } if (length(terra::time(x2)) == length(terra::time(x))) { terra::time(x2) <- terra::time(x) - out$time <- terra::time(x) } } else { stop("Expected x to be SpatVector or SpatRaster") @@ -106,12 +103,10 @@ toolTerraToCache <- function(x, name, fname) { if (length(names(x2)) == length(names(x))) { names(x2) <- names(x) - out$names <- names(x) } else { stop("Cannot cache this terra object, because loading it from cache would yield a different number of layers. ", "Add `cache = FALSE` to the returned list to disable caching.") } - out$x <- terra::wrap(x2) - return(out) + return(terra::wrap(x2)) } From 3ac7fb243bd917916e04680f1b7d816cb50695e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Tue, 9 May 2023 14:55:30 +0200 Subject: [PATCH 10/10] buildlibrary --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- README.md | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index fe874044..c5ddd346 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '' +ValidationKey: '6469352' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/CITATION.cff b/CITATION.cff index 39b8b8b6..10b24416 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -2,8 +2,8 @@ cff-version: 1.2.0 message: If you use this software, please cite it using the metadata from this file. type: software title: 'madrat: May All Data be Reproducible and Transparent (MADRaT) *' -version: 3.3.1 -date-released: '2023-05-08' +version: 3.3.2 +date-released: '2023-05-09' abstract: Provides a framework which should improve reproducibility and transparency in data processing. It provides functionality such as automatic meta data creation and management, rudimentary quality management, data caching, work-flow management diff --git a/DESCRIPTION b/DESCRIPTION index 21d7a64d..b87ce06e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: madrat Title: May All Data be Reproducible and Transparent (MADRaT) * -Version: 3.3.1 -Date: 2023-05-08 +Version: 3.3.2 +Date: 2023-05-09 Authors@R: c( person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = c("aut", "cre")), person("Lavinia", "Baumstark", , "lavinia@pik-potsdam.de", role = "aut"), diff --git a/README.md b/README.md index 7065674f..2e8834e9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # May All Data be Reproducible and Transparent (MADRaT) * -R package **madrat**, version **3.3.1** +R package **madrat**, version **3.3.2** [![CRAN status](https://www.r-pkg.org/badges/version/madrat)](https://cran.r-project.org/package=madrat) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1115490.svg)](https://doi.org/10.5281/zenodo.1115490) [![R build status](https://github.com/pik-piam/madrat/workflows/check/badge.svg)](https://github.com/pik-piam/madrat/actions) [![codecov](https://codecov.io/gh/pik-piam/madrat/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/madrat) [![r-universe](https://pik-piam.r-universe.dev/badges/madrat)](https://pik-piam.r-universe.dev/builds) @@ -55,7 +55,7 @@ In case of questions / problems please contact Jan Philipp Dietrich . +Dietrich J, Baumstark L, Wirth S, Giannousakis A, Rodrigues R, Bodirsky B, Kreidenweis U, Klein D, Führlich P (2023). _madrat: May All Data be Reproducible and Transparent (MADRaT)_. doi:10.5281/zenodo.1115490 , R package version 3.3.2, . A BibTeX entry for LaTeX users is @@ -64,7 +64,7 @@ A BibTeX entry for LaTeX users is title = {madrat: May All Data be Reproducible and Transparent (MADRaT)}, author = {Jan Philipp Dietrich and Lavinia Baumstark and Stephen Wirth and Anastasis Giannousakis and Renato Rodrigues and Benjamin Leon Bodirsky and Ulrich Kreidenweis and David Klein and Pascal Führlich}, year = {2023}, - note = {R package version 3.3.1}, + note = {R package version 3.3.2}, doi = {10.5281/zenodo.1115490}, url = {https://github.com/pik-piam/madrat}, }