From 282d2991877df6d117e0e6377ae2486f0b3d4ccb Mon Sep 17 00:00:00 2001 From: ManuelKurmann <147698793+ManuelKurmann@users.noreply.github.com> Date: Mon, 27 Apr 2026 14:31:41 +0200 Subject: [PATCH 1/5] Feedback on testing the tutorial in evoland.qmd --- vignettes/evoland.qmd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vignettes/evoland.qmd b/vignettes/evoland.qmd index ea6121e..df5447e 100644 --- a/vignettes/evoland.qmd +++ b/vignettes/evoland.qmd @@ -370,7 +370,7 @@ db$trans_preds_t <- db$get_pruned_trans_preds_t( Now we fit partial models using training/validation splits, allowing for a goodness-of-fit (gof) estimation. Here, we only fit a single partial model per transition, where we normally would create a list of candidates. -We can then pick the models with the best goodness of fit to retrain full models on all of the available predictor data; the full models are then used during extrapolation. +Next, fit_full_models() reads the partial models stored in db$trans_models_t, chooses the best model for each transition based on goodness of fit, and refits each chosen model on all available predictor data. Assigning the result back to db$trans_models_t stores these full models for the extrapolation step. ```{r} #| label: trans-models @@ -419,6 +419,8 @@ With all components in place, we run the allocation step. If Dinamica is not installed, you'll get a warning that the anterior LULC map is returned as the posterior. For installation instructions, see the [Installing Dinamica EGO](install-dinamica.html) vignette. + + ```{r} #| label: allocation #| results: hold From 2572858ff8a4b8cbdfe7ba56e51f4c7b8e77299f Mon Sep 17 00:00:00 2001 From: ManuelKurmann <147698793+ManuelKurmann@users.noreply.github.com> Date: Mon, 27 Apr 2026 15:31:30 +0200 Subject: [PATCH 2/5] Small fixes - Bump terra to >= 1.8-42 for data.table rasterization support - Pass GOF selection args to alloc_dinamica() in test_integ_allocation.R. - TODO removed --- DESCRIPTION | 2 +- inst/tinytest/test_integ_allocation.R | 2 ++ vignettes/evoland.qmd | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 322f390..e62abf1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,7 +22,7 @@ Imports: qs2, R6, Rcpp, - terra + terra (>=1.8-42) Suggests: base64enc, butcher, diff --git a/inst/tinytest/test_integ_allocation.R b/inst/tinytest/test_integ_allocation.R index 06884d7..60e9fc1 100644 --- a/inst/tinytest/test_integ_allocation.R +++ b/inst/tinytest/test_integ_allocation.R @@ -49,6 +49,8 @@ if (Sys.which("DinamicaConsole") == "") { expect_stdout( db$alloc_dinamica( id_periods = 4, + gof_criterion = "auc", + gof_maximize = TRUE, work_dir = file.path(db$path, "dinamica_test"), keep_intermediate = FALSE ), diff --git a/vignettes/evoland.qmd b/vignettes/evoland.qmd index df5447e..bd005e0 100644 --- a/vignettes/evoland.qmd +++ b/vignettes/evoland.qmd @@ -419,8 +419,6 @@ With all components in place, we run the allocation step. If Dinamica is not installed, you'll get a warning that the anterior LULC map is returned as the posterior. For installation instructions, see the [Installing Dinamica EGO](install-dinamica.html) vignette. - - ```{r} #| label: allocation #| results: hold From 44cee364f94a300771c118f6549c07b061514685 Mon Sep 17 00:00:00 2001 From: mmyrte <24587121+mmyrte@users.noreply.github.com> Date: Tue, 28 Apr 2026 17:52:22 +0200 Subject: [PATCH 3/5] fix DESCRIPTION format error --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index e62abf1..eff316e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,7 +22,7 @@ Imports: qs2, R6, Rcpp, - terra (>=1.8-42) + terra (>= 1.8-42) Suggests: base64enc, butcher, From 7a7e62d34108a100e3f287510a96acdb564869bb Mon Sep 17 00:00:00 2001 From: mmyrte <24587121+mmyrte@users.noreply.github.com> Date: Tue, 28 Apr 2026 17:53:32 +0200 Subject: [PATCH 4/5] further fixes to test_integ_allocation --- inst/tinytest/test_integ_allocation.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inst/tinytest/test_integ_allocation.R b/inst/tinytest/test_integ_allocation.R index 60e9fc1..1eb3129 100644 --- a/inst/tinytest/test_integ_allocation.R +++ b/inst/tinytest/test_integ_allocation.R @@ -30,6 +30,8 @@ expect_message( "Fitting full models for" ) +# switching run to no 1, which is the base estimate for allocation parameters +db$id_run <- 1L # no data for period 4 yet expect_equal(nrow(db$fetch("lulc_data_t", where = "id_period = 4")), 0L) @@ -46,7 +48,7 @@ if (Sys.which("DinamicaConsole") == "") { "Copying anterior.tif to posterior.tif as fallback so we can test." ) } else { - expect_stdout( + expect_message( db$alloc_dinamica( id_periods = 4, gof_criterion = "auc", From f9290ca3da28d3469ef06582578fe82103edb815 Mon Sep 17 00:00:00 2001 From: mmyrte <24587121+mmyrte@users.noreply.github.com> Date: Tue, 28 Apr 2026 17:54:01 +0200 Subject: [PATCH 5/5] bug fix: even if no patcher is used, passing 0 will result in dinamica error --- R/alloc_dinamica.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/alloc_dinamica.R b/R/alloc_dinamica.R index 66cf257..7d43e9a 100644 --- a/R/alloc_dinamica.R +++ b/R/alloc_dinamica.R @@ -80,9 +80,9 @@ alloc_dinamica_setup_inputs <- function( patcher_table <- alloc_params_full[, .( `From*` = id_lulc_anterior, `To*` = id_lulc_posterior, - Mean_Patch_Size = ifelse(is.na(mean_patch_size), 0, mean_patch_size), + Mean_Patch_Size = ifelse(is.na(mean_patch_size), 1, mean_patch_size), Patch_Size_Variance = ifelse(is.na(patch_size_variance), 0, patch_size_variance), - Patch_Isometry = ifelse(is.na(patch_isometry), 0, patch_isometry) + Patch_Isometry = ifelse(is.na(patch_isometry), 1, patch_isometry) )] patcher_path <- file.path(temp_dir, "patcher_table.csv")