Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Feret Jean-Baptiste
biodivMapR
Commits
cb7e372e
Commit
cb7e372e
authored
Jan 25, 2020
by
Jean-Baptiste Feret
Browse files
added error message when center & reduction of kmeans results produces NAs or Inf values.
parent
e3b1777b
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/Lib_MapSpectralSpecies.R
View file @
cb7e372e
...
...
@@ -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
(
is.na
(
m0
)))
>
0
|
length
(
which
(
is.na
(
M0
)))
>
0
|
length
(
which
(
is.infinite
(
m0
)))
>
0
|
length
(
which
(
is.infinite
(
M0
)))
>
0
){
message
(
""
)
message
(
"*********************************************************"
)
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 "
)
message
(
"*********************************************************"
)
message
(
""
)
stop
()
}
dataPCA
<-
center_reduce
(
dataPCA
,
m0
,
d0
)
# get the dimensions of the images, and the number of subimages to process
dataPCA
<-
split
(
as.data.frame
(
dataPCA
),
rep
(
1
:
nb_partitions
,
each
=
Pix_Per_Partition
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment