Commit e7a8c2f2 authored by Romulo Pereira Goncalves's avatar Romulo Pereira Goncalves
Browse files

Colnames should come from the original raster.

parent 2b7e90b8
......@@ -113,6 +113,7 @@ sample_nb <- function(raster,
1:nb_mean,
model_opt_r,
raster = rast,
col_names = colnames(raster),
sample_type = sample_type,
buffer = buffer,
model = model,
......@@ -138,6 +139,7 @@ sample_nb <- function(raster,
for (k in 1:nb_mean) {
res <- model_opt_r(
raster = rast,
col_names = colnames(raster),
sample_type = sample_type,
buffer = buffer,
model = model,
......
......@@ -4,6 +4,7 @@
#'
#' @param k Iteration value for the models.
#' @param raster satellite time series stack (rasterBrickObject) or just any type of image (*rasterObject)
#' @param col_names layer names
#' @param sample_type distribution of spatial locations c("random","regular")
#' @param buffer distance (in m) for new sample collection around initial samples (depends on pixel size)
#' @param model which machine learning classifier to use c("rf", "svm") for random forest or support vector machine implementation
......@@ -25,6 +26,7 @@
#' @keywords internal
model_opt_r <- function(k,
raster,
col_names,
sample_type,
buffer,
model,
......@@ -157,7 +159,7 @@ model_opt_r <- function(k,
if (ncol(test1) == 1) {
test1 <- t(test1)
}
colnames(test1) <- names(rast)
colnames(test1) <- col_names
}
if (class(test1)[1] == "numeric") {
test1 <- t(matrix(test1))
......
......@@ -7,6 +7,7 @@
model_opt_r(
k,
raster,
col_names,
sample_type,
buffer,
model,
......@@ -26,6 +27,8 @@ model_opt_r(
\item{raster}{satellite time series stack (rasterBrickObject) or just any type of image (*rasterObject)}
\item{col_names}{layer names}
\item{sample_type}{distribution of spatial locations c("random","regular")}
\item{buffer}{distance (in m) for new sample collection around initial samples (depends on pixel size)}
......
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