diff --git a/DESCRIPTION b/DESCRIPTION index 3e741be..521cf4b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mlr3spatial Title: Support for Spatial Objects Within the 'mlr3' Ecosystem -Version: 0.6.0.9000 -Date: 2025-07-18 +Version: 0.6.1 +Date: 2025-09-14 Authors@R: c( person("Marc", "Becker", , "marcbecker@posteo.de", role = c("aut", "cre"), @@ -17,7 +17,7 @@ URL: https://mlr3spatial.mlr-org.com, https://github.com/mlr-org/mlr3spatial BugReports: https://github.com/mlr-org/mlr3spatial/issues Depends: - mlr3 (>= 1.1.0), + mlr3 (>= 1.2.0), R (>= 3.1.0) Imports: checkmate (>= 2.0.0), @@ -42,8 +42,6 @@ Suggests: rpart, stars (>= 0.5-5), testthat (>= 3.0.0) -Remotes: - mlr-org/mlr3 VignetteBuilder: knitr Config/testthat/edition: 3 diff --git a/NAMESPACE b/NAMESPACE index a711d40..f607705 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -59,6 +59,7 @@ importFrom(R6,R6Class) importFrom(R6,is.R6) importFrom(methods,as) importFrom(stats,complete.cases) +importFrom(stats,runif) importFrom(terra,cats) importFrom(terra,head) importFrom(terra,intersect) diff --git a/NEWS.md b/NEWS.md index aec7e2b..3f0240e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,7 @@ -# mlr3spatial (development version) +# mlr3spatial 0.6.1 + +* compatibility: mlr3 1.2.0 removed the data format argument +* fix: `$predict_newdata()` and `predict_spatial()` work without optional column roles like `coordinate` now. # mlr3spatial 0.6.0 diff --git a/R/data.R b/R/data.R index f433035..2d8354a 100644 --- a/R/data.R +++ b/R/data.R @@ -98,6 +98,7 @@ generate_stack = function(layers, layer_size = NULL, dimension = NULL, multi_lay if (layer$type == "numeric") { data = matrix(c(stats::rnorm(floor(dimension^2 / 2), 0, 1), stats::rnorm(ceiling(dimension^2 / 2), 1, 1)), nrow = dimension) ras = rast(data) + terra::crs(ras) = "EPSG:4326" if (!layer$in_memory && !multi_layer_file) { filename = tempfile(fileext = ".tif") writeRaster(ras, filename) @@ -107,6 +108,7 @@ generate_stack = function(layers, layer_size = NULL, dimension = NULL, multi_lay } else if (layer$type == "factor") { data = matrix(rep(seq_along(layer$levels), each = floor(dimension^2 / length(layer$levels)), length.out = dimension^2), nrow = dimension) ras = rast(data) + terra::crs(ras) = "EPSG:4326" ras = terra::categories(ras, layer = 1, data.table(ID = seq_along(layer$levels), category = layer$levels)) if (!layer$in_memory && !multi_layer_file) { filename = tempfile(fileext = ".tif") @@ -117,6 +119,7 @@ generate_stack = function(layers, layer_size = NULL, dimension = NULL, multi_lay } else if (layer$type == "weights") { data = matrix(runif(dimension^2, 0, 1), nrow = dimension) ras = rast(data) + terra::crs(ras) = "EPSG:4326" if (!layer$in_memory && !multi_layer_file) { filename = tempfile(fileext = ".tif") writeRaster(ras, filename) diff --git a/R/zzz.R b/R/zzz.R index a4d76be..2550a31 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -4,7 +4,7 @@ #' @import mlr3 #' @import sf #' @importFrom R6 R6Class is.R6 -#' @importFrom stats complete.cases +#' @importFrom stats complete.cases runif #' @importFrom utils getFromNamespace data #' #' @section Learn mlr3: diff --git a/man/mlr3spatial-package.Rd b/man/mlr3spatial-package.Rd index 05ee881..3e04da4 100644 --- a/man/mlr3spatial-package.Rd +++ b/man/mlr3spatial-package.Rd @@ -66,7 +66,7 @@ likely be removed in a future version of the package. analysis. \references{ Becker M, Schratz P (2025). \emph{mlr3spatial: Support for Spatial Objects Within the 'mlr3' Ecosystem}. -R package version 0.6.0.9000, \url{https://mlr3spatial.mlr-org.com}. +R package version 0.6.1, \url{https://mlr3spatial.mlr-org.com}. } \seealso{ Useful links: diff --git a/tests/testthat/test_DataBackendRaster.R b/tests/testthat/test_DataBackendRaster.R index ca151b0..3913a65 100644 --- a/tests/testthat/test_DataBackendRaster.R +++ b/tests/testthat/test_DataBackendRaster.R @@ -273,7 +273,7 @@ test_that("data prototyp works", { ) backend = DataBackendRaster$new(stack) - expect_data_table(backend$data(rows = integer(0), cols = c("x_1", "y")), nrows = 0, ncols = 2) + suppressWarnings(expect_data_table(backend$data(rows = integer(0), cols = c("x_1", "y")), nrows = 0, ncols = 2)) }) test_that("in memory rasters work", {