Skip to content

Commit 832aa9e

Browse files
committed
Small bug fix in engine_gdb when full matrix weights are scaled (now to 1)
1 parent 0ded9d2 commit 832aa9e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* Small bug fixed related to manual provision of scenario thresholds.
1212
* `predictor_filter()` now also accepts [`SpatRaster`] objects as inputs.
1313
* Small fix so that bounding box extent is correctly printed #138
14+
* Small bug fix to `engine_gdb` in dev branch.
1415

1516
# ibis.iSDM 0.1.5
1617

R/engine_gdb.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,11 @@ engine_gdb <- function(x,
335335
full <- model$predictors
336336
full <- subset(full, select = c('x','y',model$biodiversity[[1]]$predictors_names))
337337
full$cellid <- rownames(full) # Add row.names
338-
full$w <- model$exposure
339338
full$Intercept <- 1
340339
full <- subset(full, stats::complete.cases(full))
341340
# Clamp?
342341
if( settings$get("clamp") ) full <- clamp_predictions(model, full)
343-
344-
full$w <- scale_weight(full$w)
342+
full$w <- scale_weight(model$exposure)
345343
assertthat::assert_that(
346344
all(model$biodiversity[[1]]$predictors_names %in% names(full)),
347345
all(names(full[,model$biodiversity[[1]]$predictors_names]) %in% names(data)),

R/utils.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ thresholdval <- function(x, knot, sense = "gte") {
322322
#'
323323
#' @noRd
324324
scale_weight <- function(v, method = "scale"){
325+
if(is.null(v)) return(1) # Return dummy 1 for equal weight
325326
assertthat::assert_that(
326327
length(v)>1,
327328
is.character(method)

0 commit comments

Comments
 (0)