biomodhub / biomod2

BIOMOD is a computer platform for ensemble forecasting of species distributions, enabling the treatment of a range of methodological uncertainties in models and the examination of species-environment relationships.
85 stars 22 forks source link

Ensemble projection issue - with new environment #208

Closed ellalewi547 closed 1 year ago

ellalewi547 commented 1 year ago

Hello, I am having an issue with the ensemble projections onto a new environment. I have run the single model and ensemble projections on the current environment and this has worked. Then when I conducted the single models on the new environment (Britain) the model iterations such as PA1 RUN1 GLM PA, RUN2 GAM (etc) the layer names have changed to lyr1, ly1, X1, canopy height. And then it won't let me run the ensemble model as it doesn't understand which files to use. This suggests to me that the issue is that the raster stack for the current and new environment don't match but I have double checked and they are named the same and the order is the same. Do you know why this could be happening. I have attached the code I had run for the new environment, the qgis outputs for the projections on the single model new environment projections, as well as the warning message for the ensemble projection.

The raster stacks are here also:

Current environment: (europe)

[[1]] class : RasterLayer dimensions : 4365, 4995, 21803175 (nrow, ncol, ncell) resolution : 1000, 1000 (x, y) extent : 2436837, 7431837, 1297579, 5662579 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : reference elevation.tif names : reference.elevation

[[2]] class : RasterLayer dimensions : 4365, 4995, 21803175 (nrow, ncol, ncell) resolution : 1000, 1000 (x, y) extent : 2436837, 7431837, 1297579, 5662579 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : canopy.height values : 0, 42.86193 (min, max)

[[3]] class : RasterLayer dimensions : 4365, 4995, 21803175 (nrow, ncol, ncell) resolution : 1000, 1000 (x, y) extent : 2436837, 7431837, 1297579, 5662579 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : forest.density values : 0, 100 (min, max)

[[4]] class : RasterLayer dimensions : 4365, 4995, 21803175 (nrow, ncol, ncell) resolution : 1000, 1000 (x, y) extent : 2436837, 7431837, 1297579, 5662579 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : NVDI values : -7.305202e+37, 8.348445e+37 (min, max)

[[5]] class : RasterLayer dimensions : 4365, 4995, 21803175 (nrow, ncol, ncell) resolution : 1000, 1000 (x, y) extent : 2436837, 7431837, 1297579, 5662579 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : rainfall values : 6.438902, 308.843 (min, max)

[[6]] class : RasterLayer dimensions : 4365, 4995, 21803175 (nrow, ncol, ncell) resolution : 1000, 1000 (x, y) extent : 2436837, 7431837, 1297579, 5662579 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : slope values : 0, 40.53222 (min, max)

[[7]] class : RasterLayer dimensions : 4365, 4995, 21803175 (nrow, ncol, ncell) resolution : 1000, 1000 (x, y) extent : 2436837, 7431837, 1297579, 5662579 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : temperature values : -10.4395, 20.00581 (min, max)

[[8]] class : RasterLayer dimensions : 4365, 4995, 21803175 (nrow, ncol, ncell) resolution : 1000, 1000 (x, y) extent : 2436837, 7431837, 1297579, 5662579 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : TPI values : -278.496, 309.1874 (min, max)

[[9]] class : RasterLayer dimensions : 4365, 4995, 21803175 (nrow, ncol, ncell) resolution : 1000, 1000 (x, y) extent : 2436837, 7431837, 1297579, 5662579 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : dominant.tree.species values : 0, 20 (min, max)

[[10]] class : RasterLayer dimensions : 4365, 4995, 21803175 (nrow, ncol, ncell) resolution : 1000, 1000 (x, y) extent : 2436837, 7431837, 1297579, 5662579 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : land.cover values : 1, 17 (min, max)

New environment: (britian)

[[1]] class : RasterLayer dimensions : 1731, 2411, 4173441 (nrow, ncol, ncell) resolution : 100, 100 (x, y) extent : 3486173, 3727273, 3114979, 3288079 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : reference.elevation values : -32.72809, 296.6667 (min, max)

[[2]] class : RasterLayer dimensions : 1731, 2411, 4173441 (nrow, ncol, ncell) resolution : 100, 100 (x, y) extent : 3486173, 3727273, 3114979, 3288079 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : canopy.height values : 0, 25.85179 (min, max)

[[3]] class : RasterLayer dimensions : 1731, 2411, 4173441 (nrow, ncol, ncell) resolution : 100, 100 (x, y) extent : 3486173, 3727273, 3114979, 3288079 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : forest.density values : 0, 99.79135 (min, max)

[[4]] class : RasterLayer dimensions : 1731, 2411, 4173441 (nrow, ncol, ncell) resolution : 100, 100 (x, y) extent : 3486173, 3727273, 3114979, 3288079 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : NVDI values : 0, 0.8368984 (min, max)

[[5]] class : RasterLayer dimensions : 1731, 2411, 4173441 (nrow, ncol, ncell) resolution : 100, 100 (x, y) extent : 3486173, 3727273, 3114979, 3288079 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : rainfall values : 44.17611, 81.18701 (min, max)

[[6]] class : RasterLayer dimensions : 1731, 2411, 4173441 (nrow, ncol, ncell) resolution : 100, 100 (x, y) extent : 3486173, 3727273, 3114979, 3288079 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : slope values : 0, 36.83173 (min, max)

[[7]] class : RasterLayer dimensions : 1731, 2411, 4173441 (nrow, ncol, ncell) resolution : 100, 100 (x, y) extent : 3486173, 3727273, 3114979, 3288079 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : temperature values : 8.990372, 11.07132 (min, max)

[[8]] class : RasterLayer dimensions : 1731, 2411, 4173441 (nrow, ncol, ncell) resolution : 100, 100 (x, y) extent : 3486173, 3727273, 3114979, 3288079 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : TPI values : -15.00411, 12.51562 (min, max)

[[9]] class : RasterLayer dimensions : 1731, 2411, 4173441 (nrow, ncol, ncell) resolution : 100, 100 (x, y) extent : 3486173, 3727273, 3114979, 3288079 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : dominant.tree.species values : 0, 19 (min, max)

[[10]] class : RasterLayer dimensions : 1731, 2411, 4173441 (nrow, ncol, ncell) resolution : 100, 100 (x, y) extent : 3486173, 3727273, 3114979, 3288079 (xmin, xmax, ymin, ymax) crs : +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs source : memory names : land.cover values : 1, 17 (min, max)

The attatched screenshots: pasted image 0 (4) pasted image 0 (3) pasted image 0 (2) pasted image 0 (1)

Thank you so much, Ella.

ellalewi547 commented 1 year ago

This is the error message: image

rpatin commented 1 year ago

Hi Ella, Thank you for reporting :pray: I think believe this bug was fixed in the current development branch. It should be out in a few weeks. Meanwhile, you can also try and install it with the following command:

library(devtools)
devtools::install_github("biomodhub/biomod2", ref = "devel_current")

Then, the issue you have with BIOMOD_EnsembleForecasting should solve itself. Feel free to let us know if you encounter troubles with the development branch.

Also, please avoid using screenshots for showing code input or console output, it is best to copy-paste it and format it with github tools ('add code'). That way it will be easier for us to use your code to reproduce your error (or to paste the error for a web search) and also improve referencing, making it easier for other people that looks for a given error on the web to find your issue.

Thanks in advance :pray: Rémi

ellalewi547 commented 1 year ago

Hi Remi thank you so much for your rapid response, I will try it with the update version. And no worries, thanks for the tip!

ellalewi547 commented 1 year ago

Hi Remi, I have downloaded the new update for biomod2 update as you suggested, and I am still having the same error message. I just want to make sure what the bug actually is actually is? As I'm not sure if it could be an issue on my end rather than biomod. I have been able to do successfully run the ensemble forecasting on the current environmental variables and it did not mess up the projection output names (eg. PA1_RUN1_GLM). So, I'm not sure if its an issue with my new environment rasterstack? Thank you very much, Ella.

rpatin commented 1 year ago

Hi Ella, Sorry that it did not solved your problem :pray:

Maybe it is another issue then. Could you share (by copy-pasting):

If I summarize your issue:

  1. You ran successfully the models (BIOMOD_Modeling and BIOMOD_EnsembleModeling)
  2. You ran successfully the projection on current environment (BIOMOD_Projection and BIOMOD_EnsembleForecasting). The projection you obtain have appropriate layer names.
  3. You have troubles running the projection on a new environment (BIOMOD_Projection and BIOMOD_EnsembleForecasting). You have an error in BIOMOD_Projection about layer names.

Is that it ?

Best, Rémi

ellalewi547 commented 1 year ago

Hi Remi thanks so much for your response. The code for the updated github version of biomod2 does not work when I try to install it. library(devtools) devtools::install_github("biomodhub/biomod2", ref = "devel_current") I have tried it without the ref = "devel_current" and it has worked but I'm not sure if this is a necessary parameter to avoid the bug issue , do you know how I can correctly install the new update?

rpatin commented 1 year ago

Hi Ella, Sorry, this is also our internal development branch and we have been working quite a lot on it in the past days. It should be working again in the upcoming weeks. Meanwhile (and as it is likely not necessary to fix your bug as you said before) you can use the current github version with

library(devtools) 
devtools::install_github("biomodhub/biomod2")

Best, Rémi

ellalewi547 commented 1 year ago

Thank you Rémi, Your summary is correct.

Here's the details

Species modeled : Martesmartes

Modeling id : 1678725979

Considered variables : reference.elevation canopy.height forest.density NVDI rainfall slope temperature TPI dominant.tree.species land.cover

Computed Models : Martesmartes_PA1_RUN1_GLM Martesmartes_PA1_RUN1_GAM Martesmartes_PA1_RUN1_GBM Martesmartes_PA1_RUN1_CTA Martesmartes_PA1_RUN1_ANN Martesmartes_PA1_RUN1_SRE Martesmartes_PA1_RUN1_FDA Martesmartes_PA1_RUN1_MARS Martesmartes_PA1_RUN1_RF Martesmartes_PA1_RUN1_MAXNET Martesmartes_PA1_RUN2_GLM Martesmartes_PA1_RUN2_GAM Martesmartes_PA1_RUN2_GBM Martesmartes_PA1_RUN2_CTA Martesmartes_PA1_RUN2_ANN Martesmartes_PA1_RUN2_SRE Martesmartes_PA1_RUN2_FDA Martesmartes_PA1_RUN2_MARS Martesmartes_PA1_RUN2_RF Martesmartes_PA1_RUN2_MAXNET Martesmartes_PA1_RUN3_GLM Martesmartes_PA1_RUN3_GAM Martesmartes_PA1_RUN3_GBM Martesmartes_PA1_RUN3_CTA Martesmartes_PA1_RUN3_ANN Martesmartes_PA1_RUN3_SRE Martesmartes_PA1_RUN3_FDA Martesmartes_PA1_RUN3_MARS Martesmartes_PA1_RUN3_RF Martesmartes_PA1_RUN3_MAXNET Martesmartes_PA2_RUN1_GLM Martesmartes_PA2_RUN1_GAM Martesmartes_PA2_RUN1_GBM Martesmartes_PA2_RUN1_CTA Martesmartes_PA2_RUN1_ANN Martesmartes_PA2_RUN1_SRE Martesmartes_PA2_RUN1_FDA Martesmartes_PA2_RUN1_MARS Martesmartes_PA2_RUN1_RF Martesmartes_PA2_RUN1_MAXNET Martesmartes_PA2_RUN2_GLM Martesmartes_PA2_RUN2_GAM Martesmartes_PA2_RUN2_GBM Martesmartes_PA2_RUN2_CTA Martesmartes_PA2_RUN2_ANN Martesmartes_PA2_RUN2_SRE Martesmartes_PA2_RUN2_FDA Martesmartes_PA2_RUN2_MARS Martesmartes_PA2_RUN2_RF Martesmartes_PA2_RUN2_MAXNET Martesmartes_PA2_RUN3_GLM Martesmartes_PA2_RUN3_GAM Martesmartes_PA2_RUN3_GBM Martesmartes_PA2_RUN3_CTA Martesmartes_PA2_RUN3_ANN Martesmartes_PA2_RUN3_SRE Martesmartes_PA2_RUN3_FDA Martesmartes_PA2_RUN3_MARS Martesmartes_PA2_RUN3_RF Martesmartes_PA2_RUN3_MAXNET Martesmartes_PA3_RUN1_GLM Martesmartes_PA3_RUN1_GAM Martesmartes_PA3_RUN1_GBM Martesmartes_PA3_RUN1_CTA Martesmartes_PA3_RUN1_ANN Martesmartes_PA3_RUN1_SRE Martesmartes_PA3_RUN1_FDA Martesmartes_PA3_RUN1_MARS Martesmartes_PA3_RUN1_RF Martesmartes_PA3_RUN1_MAXNET Martesmartes_PA3_RUN2_GLM Martesmartes_PA3_RUN2_GAM Martesmartes_PA3_RUN2_GBM Martesmartes_PA3_RUN2_CTA Martesmartes_PA3_RUN2_ANN Martesmartes_PA3_RUN2_SRE Martesmartes_PA3_RUN2_FDA Martesmartes_PA3_RUN2_MARS Martesmartes_PA3_RUN2_RF Martesmartes_PA3_RUN2_MAXNET Martesmartes_PA3_RUN3_GLM Martesmartes_PA3_RUN3_GAM Martesmartes_PA3_RUN3_GBM Martesmartes_PA3_RUN3_CTA Martesmartes_PA3_RUN3_ANN Martesmartes_PA3_RUN3_SRE Martesmartes_PA3_RUN3_FDA Martesmartes_PA3_RUN3_MARS Martesmartes_PA3_RUN3_RF Martesmartes_PA3_RUN3_MAXNET

Failed Models : none


- the code you used to do BIOMOD_Projection (new environment):

myBiomodProjBritishRasters <- BIOMOD_Projection( bm.mod = myBiomodModelOut, new.env = myExpl2, proj.name = '100m_Britain_3RUNS', models.chosen = 'all', metric.binary = 'TSS', metric.filter = NULL, compress = TRUE,
build.clamping.mask = TRUE, nb.cpu = 10, seed.val = 1)


-BIOMOD_EnsembleForecasting (new environment):

myBiomodEFBritain <- BIOMOD_EnsembleForecasting( bm.em = myBiomodEM, bm.proj = myBiomodProjBritishRasters, models.chosen = "all", metric.binary = 'TSS', metric.filter = NULL, compress = TRUE, nb.cpu = 10, build.clamping.mask = TRUE, seed.val = 1 )


- BIOMOD_Projection (current environment):

myBiomodProjEuropeRasters <- BIOMOD_Projection( bm.mod = myBiomodModelOut, new.env = MyExpl3, proj.name = 'currentCategories', models.chosen = 'all', metric.binary = 'TSS', metric.filter = NULL, compress = TRUE, build.clamping.mask = TRUE, nb.cpu = 10, seed.val = 1 )


 MyExpl3 is the same rasterstack of Europe but cropped and masked to a Britain shapefile.

-BIOMOD_EnsembleForecasting (current environment):

myBiomodEF <- BIOMOD_EnsembleForecasting( bm.em = myBiomodEM, bm.proj = myBiomodProjEuropeRasters, proj.name = 'current_ensembleCategories', new.env.xy = NULL, models.chosen = "all", metric.binary = 'TSS', metric.filter = NULL, compress = TRUE, nb.cpu = 10, build.clamping.mask = TRUE, seed.val = 1 )



It is very much appreciated, sorry my r skills aren't great. 
Ella :) 
rpatin commented 1 year ago

Hi Ella, Thank you for the additional information :pray: Unfortunately I did not manage to reproduce the issue yet. Would it be possible to access your data and script to try and understand what is happening ? (here is my mail: remi.patin@univ-grenoble-alpes.fr) Best, Rémi

ellalewi547 commented 1 year ago

Hi Rémi, thanks a lot for offering to inspect the code. I have sent you a link to a shared one drive folder via teams, just let me know if you have an issue accessing the data and if you are unsure about any of the folders or script. Just a headsup, the current environment data has already been cropped/masked/resampled so the files just need renaming, reordering and stacked which is in the code. The future environment has not, so it needs resampling etc to be put into the projection modelling but this doesn't take much time as it gets cropped to the South East England.

Again, thank you so much. Ella :)

rpatin commented 1 year ago

Hi Ella, Sorry, I do not use Teams so I did not get any link to the shared folder. Could you share it by mail ? Thanks for the note on the cropping/resampling/renaming. I must admit your issue is quite puzzling for now (both this one and the one on categorical variable problem you discussed with Maya) but there might be something happening in the cropping/renaming/resampling that interfere is then badly handled in our codes. Best, Rémi

ellalewi547 commented 1 year ago

Hi Rémi, yeah I'm extremely puzzled, and I've had more error messages since using the as.factor on the raster stack so I'm not sure what is going on. I have sent you a link to the shared document via teams, but if this doesn't work for you I will send it directly over email. Let me know if you have any issues, many thanks Ella!

rpatin commented 1 year ago

Hi Ella, I follow the post in issue https://github.com/biomodhub/biomod2/issues/218. Thank you again for providing the data, this really makes our life easier for helping you :pray: Once fixing the issue with categorical variables, I could run you whole script without any issue. I just had a few minor code adjustment:

If your issues persist while you are using the new patch (see issue https://github.com/biomodhub/biomod2/issues/218), feel free to update this issue as well with the problem encountered.

Best, Rémi

ellalewi547 commented 1 year ago

Thank you so much for taking the time to do that, your response has been so helpful! I will let you know if I have any issues going forwards. Ella :)

ellalewi547 commented 1 year ago

Sorry just to add to that, I forgot to mention before that we were able to resolve the issue a few days before by converting the rasterstack to a grd file (as opposed to a tif) and then reimported that rasterstack back in for the modelling. This was done for the future environment raster stack also (the british rasters), so that their source both came from a grd file. We then applied as.factor to the raster stacks and this seemed to work, even considering we had the uneven levels in that dominant tree species category layer. Thank you again for your help!

ellalewi547 commented 1 year ago

Hi Rémi, I'm sorry to bother you again, I'm in the last stage of reporting so I just need to project the final model! Since the last time we spoke, I have been able to integrate categorical variables into the model and I had also been able to resolve the issue surrounding the single model and ensemble projection on the new environment as previously discussed. However, for some reason I am having issues with this again. Oddly, when I conduct the model on certain subsets, so for example RUN1's and PA1's, the model projection will work perfectly fine, however when I conduct the models on 'all' models.chosen, I get the same issue as before where the projection maps have strange layer names eg. lyr1, ly2, pred, elevation etc.. And then this means I cannot conduct the ensemble for the new environment. I cannot understand why the model will work for certain subsets and not the full model, the only thing I could think of is that certain model repetitions do not work for some reason which causes the layers to change names. When it reports each repetition, some of the runs have a gap inbetween which may be models which don't work?

image

This is the code I have been using for the projection:

myBiomodProj_UK <- BIOMOD_Projection(
  bm.mod = myBiomodModelOut, 
  new.env = mystack_uk_pro, 
  proj.name = 'uk_el', 
  models.chosen = 'all',
  metric.binary = 'TSS', #used to be binary.meth
  metric.filter = NULL,
  compress = TRUE, 
  #output.format = ".img",    
  build.clamping.mask = TRUE, 
  nb.cpu = 10,
  seed.val = 1)

== This is all the models, which doesn't work.

However, when I do a subset, it will work without any issues:

mods <- get_built_models(obj = myBiomodModelOut, 
                         #full.name = NULL, 
                         PA = 'PA1',
                         run = 'RUN1')
myBiomodProj_UK <- BIOMOD_Projection(
  bm.mod = myBiomodModelOut, 
  new.env = mystack_uk_pro, 
  proj.name = 'uk_el', 
  models.chosen = mods,
  metric.binary = 'TSS', #used to be binary.meth
  metric.filter = NULL,
  compress = TRUE, 
  #output.format = ".img",    
  build.clamping.mask = TRUE, 
  nb.cpu = 10,
  seed.val = 1)

Do you know what could be causing this issue? Thank you very much in advance!

ellalewi547 commented 1 year ago

Sorry, just to add to this. I have repeated the same model on 3PA and 3RUNS instead of 5PA 5RUNS and this worked fine, and then when I did the exact same procedure for the 5 it gave the same layer name issue, so I'm not sure what is going on?

rpatin commented 1 year ago

Hi Ella, Thank you for the update. Which version of biomod2 are you currently using ? It seems like the issue with large expected memory use forcing terraOptions(todisk = TRUE) and causing bugs in biomod2 version < 4.2-3 Best, Rémi

ellalewi547 commented 1 year ago

Hi Rémi, thank you for your response, I am using version 4.2.3 so I'm sure that will be the reason why then. For some reason I have difficulty installing the current branch, so I'm not sure what to do.

`

Warning: package ‘biomod2’ is in use and will not be installed` For example: Warning messages: 1: In file.copy(savedcopy, lib, recursive = TRUE) : problem copying C:\Users\Ella.... Permission denied
rpatin commented 1 year ago

Hi Ella, The new version is still 4.2-3 but may have been updated since then. To upgrade the package you need to do so in a clean session (i.e. with no package loaded). Usually you need to remove all objects in your environment (rm(list = ls())) and then restart R (Session > Restart R - on Rstudio) without loading any environment (you may need to remove .RData). It will however not work if you have other R session opened on the computer with biomod2 loaded.

Then you can use devtools::install_github("biomodhub/biomod2", ref = "devel_current") to install the branch that is a few commit away from being released.

I am still puzzled about your error though and I'm not sure that the new patch will solve it. It has been encountered by other users as well (https://github.com/biomodhub/biomod2/issues/233) but I could not reproduce it yet. If you can send a full script to reproduce your error I can try again though (I should still have your data).

Best, Rémi

rpatin commented 1 year ago

Hi Ella, It seems highly similar to the other issue https://github.com/biomodhub/biomod2/issues/233#issuecomment-1505430569 ? Can you make sure that you ran both BIOMOD_Projection and BIOMOD_EnsembleForecasting with biomod2 version 4.2-3 ? Best, Rémi