Commit 6cd306ad authored by Romulo Pereira Goncalves's avatar Romulo Pereira Goncalves
Browse files

Order the variables, only save into memory current status if the user wants to...

Order the variables, only save into memory current status if the user wants to save the runs. Call garbage collector after each run.
parent 61bb25b6
......@@ -335,12 +335,15 @@ multi_Class_Sampling <- function(in.raster,
dummy <- maFo_rf@layer[[1]]
dummy[dummy < thres] <- 1
dummy[dummy >= thres] <- NA
in.raster <- in.raster * dummy
reference <- reference[-index,]
out.reference <<- reference
classNames <- classNames[-index]
out.names <<- classNames
in.raster <- in.raster * dummy
out.raster <<- in.raster
if (save_runs) {
out.reference <<- reference
out.names <<- classNames
out.raster <<- in.raster
}
remove(dummy)
remove(maFo_rf)
print(paste(paste("Habitat", i), "Done"))
......@@ -359,6 +362,8 @@ multi_Class_Sampling <- function(in.raster,
paste("threshold_step_", ni, sep = ""),
sep = ""))
}
# Release memory
gc()
if (i == r) {
print("Congratulation - you finally made it towards the last habitat")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment