Commit 12aec796 authored by Johannes Knoch's avatar Johannes Knoch
Browse files

Merge branch 'testing_development' into 'documentation'

Possiblity to resume a aborted sampling process

See merge request !8
parents c1b71758 9f41abf5
Pipeline #23671 failed with stage
in 11 seconds
......@@ -92,16 +92,21 @@ multi_Class_Sampling <- function(in.raster,
max_num_cores = 5,
plot_on_browser = TRUE) {
if (length(list.files(
outPath,
all.files = FALSE,
include.dirs = TRUE,
no.. = TRUE
)) != 0) {
message("The results directory must be empty. Don't forget to save your previous results!!!")
return(NULL)
# Checks if its a new or a resumed run and asks the user to remove all .tif
# files from the results folder in case of a new run.
if(step == 1){
if (length(list.files(
outPath,
pattern = ".tif$",
all.files = FALSE,
include.dirs = TRUE,
no.. = TRUE
)) != 0) {
message("Remove all .tif files from the Results directory! Don't forget to save them and the other files.
All other files will be overwriten when a new sampling is started.")
return(NULL)
}
}
###first steps: data preparation
if (class(reference) == "SpatialPointsDataFrame") {
reference <- as.data.frame(raster::extract(in.raster, reference))
......
......@@ -12,6 +12,29 @@
#'
#' @export
plot_results <- function(inPath, color = NULL) {
# Compares the number of .kmz to that of .tif. If .tif files are missing the
# user's attention is drawn.
if (length(list.files(
outPath,
pattern = ".tif$",
all.files = FALSE,
include.dirs = TRUE,
no.. = TRUE
)) != length(list.files(
outPath,
pattern = ".kmz$",
all.files = FALSE,
include.dirs = TRUE,
no.. = TRUE
))) {
message("Make sure the number of the .tif files fits to the number of the .kmz files and that
there are no other files from previous runs.
If you have resumed a run, then the data of the aborted and the continued run needs
to be in the Results directory. You need them for plotting the classification map.")
return(NULL)
}
curr_wd <- getwd()
##3.a.1##
setwd(inPath)
......
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