Closed yuliaUU closed 1 month ago
I found where it is originated from: in this function: https://github.com/biomodhub/biomod2/blob/master/R/BIOMOD_EnsembleForecasting.R the following part:
## 3. Get needed projections --------------------------------------------------------------------
models.needed <- get_kept_models(bm.em)
if (!is.null(bm.proj)) {
formal_pred <- get_predictions(bm.proj, full.name = models.needed)
} else {
# make prediction according to given environment
tmp_dir <- paste0('Tmp', as.numeric(Sys.time())*100000)
formal_pred <- BIOMOD_Projection(bm.mod = load_stored_object(bm.em@models.out),
new.env = new.env,
proj.name = tmp_dir,
new.env.xy = NULL,
models.chosen = models.needed,
compress = TRUE,
build.clamping.mask = FALSE,
do.stack = TRUE,
on_0_1000 = on_0_1000,
nb.cpu = nb.cpu)
formal_pred <- get_predictions(formal_pred, full.name = models.needed)
issue with load_stored_object(bm.em@models.out)
, it loads again the bm.em, while I need it to use the one already loaded.
I wonder if it is possible to resave the myBiomodEM object back after modifying it
Hello Yulia,
Thank you for posting, and for doing such a great search job 🙏 👀
Yes, the managing of file and directory paths is still not optimal...
In short, I think using dir.name
option in BIOMOD_FormatingData is a good option IF main objective is to be able to run simulation from anywhere and/or to find back where files where stored. But as soon as you move your simulation folder, it is likely to break all of it, as paths are saved, as you figured, in multiple objects, and you have to update all of them...
Did you used, when running first the simulations, this dir.name
parameter ?
Maya
I did: the issue is i made a mistake and set it up using here::here()
argument: so it saved as absolute path and not a relative path
yeh, i figured it out that i need to rerun them all with fixing teh path issue:) but thank you for your help!
It is not really a coding question: rather than the organization-related one
I am on windows, and i ran my jobs remotely. after copy all the folders with my models to my computer , and I want to run projections locally
I understand that I need to change paths stored paths in
myBiomodModelOut
andmyBiomodEM
objectsHowever, when I try to run
BIOMOD_EnsembleForecasting
i get errorsthe
BIOMOD_EnsembleForecasting
function still trying to take the old path: and I dont undertsand from where I need to change it:I also changed paths in :
myBiomodEM@link
myBiomodEM@models.prediction@link
myBiomodEM@models.evaluation@link
myBiomodEM@models.out@link
but I still get error:Error in .BIOMOD_Projection.check.args(bm.mod, proj.name, new.env, new.env.xy, : Projection files missing