Skip to content

Commit

Permalink
Small 🐛 fix that crashed modelling routine
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Jung committed Oct 24, 2023
1 parent c2db82b commit 83c3b63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Minor bug fixes in `scenario()` object, and MigClim and Kissmig wrappers.
* Bug fix related to CRS classes of sp and sf
* Bug fix related to blas.num.threads
* Bug fix that crashed `write_summary()` outputs when no prediction was made.
* Bug fix related to CRS in `engine_inla()`
* Bug fix in `engine_stan()` related to background layer

Expand Down
7 changes: 4 additions & 3 deletions R/write_output.R
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,10 @@ methods::setMethod(

# Model summary in a tibble and formula
output[["output"]][["summary"]] <- mod$summary()
if(!is.null(mod$get_data("prediction") )){
output[["output"]][["resolution"]] <- terra::res( mod$get_data("prediction") )
output[["output"]][["prediction"]] <- names( mod$get_data("prediction") )
pred <- mod$get_data("prediction")
if(!is.null(pred) && !is.Waiver(pred)){
output[["output"]][["resolution"]] <- terra::res( pred )
output[["output"]][["prediction"]] <- names( pred )
} else {
output[["output"]][["resolution"]] <- NA
output[["output"]][["prediction"]] <- NA
Expand Down

0 comments on commit 83c3b63

Please sign in to comment.