Commit cb7e372e authored by Jean-Baptiste Feret's avatar Jean-Baptiste Feret

added error message when center & reduction of kmeans results produces NAs or Inf values.

parent e3b1777b
......@@ -111,6 +111,20 @@ init_kmeans <- function(dataPCA, Pix_Per_Partition, nb_partitions, nbclusters, n
m0 <- apply(dataPCA, 2, function(x) min(x))
M0 <- apply(dataPCA, 2, function(x) max(x))
d0 <- M0 - m0
if (length(which(>0 | length(which(>0 | length(which(is.infinite(m0)))>0 | length(which(is.infinite(M0)))>0){
message("WARNING: the processing resulted in NA or infinite values")
message(" This may be due to noisy spectral domains ")
message(" This may be due to noisy spectral domains or ")
message(" individual pixels showing Inf or Na values in input data")
message(" Please check input data ")
message(" ")
message(" process aborted ")
dataPCA <- center_reduce(dataPCA, m0, d0)
# get the dimensions of the images, and the number of subimages to process
dataPCA <- split(, rep(1:nb_partitions, each = Pix_Per_Partition))
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