Commit 59f66cab authored by Romulo Pereira Goncalves's avatar Romulo Pereira Goncalves
Browse files

Remove all the NaNs from the input raster.

parent f425b983
...@@ -42,6 +42,7 @@ model_opt_r <- function(k, ...@@ -42,6 +42,7 @@ model_opt_r <- function(k,
points <- NULL points <- NULL
models <- NULL models <- NULL
oobe <- matrix(NA, nrow = n, ncol = 1) oobe <- matrix(NA, nrow = n, ncol = 1)
rast <- raster::mask(rast, raster::calc(rast, fun = sum))
for (j in 1:n) { for (j in 1:n) {
###Vorbereitung Klassifizierung ###Vorbereitung Klassifizierung
if (j == 1) { if (j == 1) {
...@@ -54,10 +55,10 @@ model_opt_r <- function(k, ...@@ -54,10 +55,10 @@ model_opt_r <- function(k,
if (sample_type == "regular") { if (sample_type == "regular") {
pbt <- raster::sampleRegular(raster, size = sample_size, sp = T) pbt <- raster::sampleRegular(raster, size = sample_size, sp = T)
} }
f <- which(is.na(pbt@data[1])) #f <- which(is.na(pbt@data[1]))
if (length(f) != 0) { #if (length(f) != 0) {
pbt <- pbt[-f,] # pbt <- pbt[-f,]
} #}
set.seed(seed2[k]) set.seed(seed2[k])
classes <- classes <-
as.factor(sample(c(1:2), size = nrow(pbt), replace = T)) as.factor(sample(c(1:2), size = nrow(pbt), replace = T))
......
Supports Markdown
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