From 5fb3f7c4d635c63c722f0733ca6188b07ef8b692 Mon Sep 17 00:00:00 2001 From: Jakub Nowosad Date: Sat, 9 Mar 2024 15:12:27 +0100 Subject: [PATCH] adds a warning message, fixes #34 --- DESCRIPTION | 2 +- R/supercells.R | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6ac69c5..20bd23e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: supercells Title: Superpixels of Spatial Data -Version: 1.0.0 +Version: 1.0.1 Authors@R: c( person(given = "Jakub", family = "Nowosad", role = c("aut", "cre"), diff --git a/R/supercells.R b/R/supercells.R index 8c8d061..c2fb1db 100644 --- a/R/supercells.R +++ b/R/supercells.R @@ -96,6 +96,8 @@ supercells = function(x, k, compactness, dist_fun = "euclidean", avg_fun = "mean # prepare minarea if (missing(minarea)){ minarea = 0 + } else if (minarea > step^2) { + warning("The provided minarea value is larger than than the average supercell (step^2). The connectivity cleaning is likely to fail.", call. = FALSE) } # disables cleaning if iter = 0 if (iter == 0){ @@ -232,7 +234,7 @@ optimize_chunk_size = function(dim_x, limit, by = 500){ # prepares the extents of chunks: # if limit = FALSE, the extent of the whole input is returned -# if limit = TRUE, the extent of the input is split into chunks, +# if limit = TRUE, the extent of the input is split into chunks, # where the size of each raster chunk is optimized to be as close to # the (hardcoded) limit of 1GB as possible # if limit is numeric, the extent of the input is split into chunks,