Skip to content

Commit

Permalink
Small 🐛 fix to write_output
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Jung committed Feb 27, 2024
1 parent 2ceaa78 commit d6c3c67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/class-biodiversityscenario.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ BiodiversityScenario <- R6::R6Class(

message(paste0(
ifelse(is.Waiver(self$limits),"Spatial-temporal scenario:","Spatial-temporal scenario (limited):"),
'\n Used model: ',ifelse(is.Waiver(fit) || isFALSE(fit), text_red('None'), class(fit)[1] ),
'\n Used model: ',ifelse(is.Waiver(fit) || isFALSE(fit), text_red('None'), fit$get_name() ),
"\n --------- ",
"\n Predictors: ", pn,
"\n Time period: ", tp,
Expand Down
10 changes: 7 additions & 3 deletions R/write_output.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ methods::setMethod(

# This function will only capture the distribution model object and will
# save them separately
if(any(mod$get_name() %in% getOption("ibis.engines")) ){
# FIXME: If errors occur, check harmonization of saving among engines.
mod$save(fname = fname)
if(inherits(mod, "BiodiversityScenario")){
if(any(mod$get_name() %in% getOption("ibis.engines")) ){
# FIXME: If errors occur, check harmonization of saving among engines.
mod$save(fname = fname)
} else {
stop("Model engine not recognized? Older version?")
}
} else if(is.Raster(mod)){
if(tools::file_ext(fname) %in% c('tif', 'TIF')) {
writeGeoTiff(file = mod, fname = fname, dt = dt)
Expand Down

0 comments on commit d6c3c67

Please sign in to comment.