connectscape/Makurhini

Problem using MK_dECA with parallel processing

Closed this issue · 1 comments

Hi!

I have been using the MK_dECA function to estimate connectivity improvements from habitat restoration.

Although the function works fine with the parameters' default values, when I specify multiple cores for parallel processing I get the following error:

in MK_dECA(nodes = list_forest_patches, attribute = NULL, area_unit = "m2",  : 
  review ECA parameters: nodes, distance file or LA

Please find the files I'm using attached and the code below

# Study area in m2 
Max_attribute <- 107055996928

# Load habitat patches
T1 <- st_read("./before_restoration.shp")
T2 <- st_read("./after_restoration.shp")

# Turn into list
list_forest_patches <- list(t1 =T1, t2 = T2)
class(list_forest_patches)
class(list_forest_patches$t1)
class(list_forest_patches$t2)

# Apply test (I have 12 cores in my computer)
dECA_test <- MK_dECA(nodes= list_forest_patches, attribute = NULL, area_unit = "m2",
                     distance = list(type= "centroid"), metric = "PC",
                     probability = 0.5, distance_thresholds = 8000, LA = Max_attribute, plot= c("Before", "After"), 
                     parallel = 5)

layers.zip

Hi,

Thank you for using the Makurhini package and reporting this issue. I have corrected the code problem and it should now work. Please uninstalll Makurhini and reinstall the package following the normal commands:

library(devtools)
library(remotes)
install_github("connectscape/Makurhini", dependencies = TRUE, upgrade = "never")

Just an observation, since you have only two times or scenaries, you may want to omit the parallel argument (i.e., parallel = NULL).

If you have any other problem please do not hesitate to report it, thank you!

Best wishes!

Oscar