Commit 8286db60 authored by Romulo Pereira Goncalves's avatar Romulo Pereira Goncalves
Browse files

Fix incomplete commit, rast is not anymore used in this function.

parent 42fa9b17
Pipeline #28193 passed with stages
in 7 minutes and 39 seconds
...@@ -49,10 +49,10 @@ model_opt_r <- function(k, ...@@ -49,10 +49,10 @@ model_opt_r <- function(k,
if (sample_type == "random") { if (sample_type == "random") {
set.seed(seed2[k]) set.seed(seed2[k])
pbt <- pbt <-
raster::sampleRandom(rast, size = sample_size, sp = T) raster::sampleRandom(raster, size = sample_size, sp = T)
} }
if (sample_type == "regular") { if (sample_type == "regular") {
pbt <- raster::sampleRegular(rast, 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) {
...@@ -146,12 +146,12 @@ model_opt_r <- function(k, ...@@ -146,12 +146,12 @@ model_opt_r <- function(k,
byid = TRUE) byid = TRUE)
test1 <- test1 <-
na.omit(raster::as.matrix(fasterize::fasterize(sf::st_as_sf(poly), rast[[1]]) * na.omit(raster::as.matrix(fasterize::fasterize(sf::st_as_sf(poly), raster[[1]]) *
rast)) raster))
nam <- nam <-
as.vector(fasterize::fasterize(sf::st_as_sf(poly), rast[[1]], field = "V1"))[-attr(test1, "na.action")] as.vector(fasterize::fasterize(sf::st_as_sf(poly), raster[[1]], field = "V1"))[-attr(test1, "na.action")]
co <- raster::xyFromCell(rast, c(1:raster::ncell(rast))[-attr(test1,"na.action")]) co <- raster::xyFromCell(raster, c(1:raster::ncell(raster))[-attr(test1,"na.action")])
pbtn1 <- as.data.frame(cbind(nam, co)) pbtn1 <- as.data.frame(cbind(nam, co))
sp::coordinates(pbtn1) <- c("x", "y") sp::coordinates(pbtn1) <- c("x", "y")
......
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