diff --git a/R/api_gdalcubes.R b/R/api_gdalcubes.R index afd24ae2..3f403956 100644 --- a/R/api_gdalcubes.R +++ b/R/api_gdalcubes.R @@ -477,15 +477,15 @@ .check_set_caller(".gc_regularize") # require gdalcubes package .check_require_packages("gdalcubes") - # prepare temp_output_dir temp_output_dir <- file.path(output_dir, ".sits") if (!dir.exists(temp_output_dir)) { dir.create(temp_output_dir, recursive = TRUE) } + # set to delete all files in temp dir + on.exit(unlink(list.files(temp_output_dir, full.names = TRUE)), add = TRUE) # timeline of intersection timeline <- .gc_get_valid_timeline(cube, period = period) - # filter only intersecting tiles if (.has(roi)) { cube <- .cube_filter_spatial(cube, roi = roi) @@ -502,8 +502,7 @@ ) # start processes .parallel_start(workers = multicores) - on.exit(.parallel_stop()) - + on.exit(.parallel_stop(), add = TRUE) # does a local cube exist local_cube <- tryCatch( { diff --git a/R/sits_regularize.R b/R/sits_regularize.R index 492987c6..f1645de4 100644 --- a/R/sits_regularize.R +++ b/R/sits_regularize.R @@ -127,7 +127,9 @@ sits_regularize.raster_cube <- function(cube, ..., output_dir <- .file_path_expand(output_dir) .check_output_dir(output_dir) # check for ROI and tiles - .check_roi_tiles(roi, tiles) + if (!is.null(roi) || !is.null(tiles)) { + .check_roi_tiles(roi, tiles) + } # check multicores .check_num_parameter(multicores, min = 1, max = 2048) # check progress