Skip to content

Commit

Permalink
fix bug related to rspatial#1218
Browse files Browse the repository at this point in the history
error with na.policy = "omit" and multilayer SpatRaster bc it was reading all layer values in the checkNA step
  • Loading branch information
see24 committed Jul 17, 2023
1 parent a8d50e9 commit 8b4cc83
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion R/focal.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,12 @@ function(x, w=3, fun="sum", ..., na.policy="all", fillvalue=NA, expand=FALSE, si
}

if (checkNA) {
mv <- readValues(x, b$row[i], b$nrows[i])
if (nl > 1) {
mv <- readValues(x[[j]], b$row[i], b$nrows[i])
} else {
mv <- readValues(x, b$row[i], b$nrows[i])
}

if (na.only) {
k <- !is.na(mv)
} else {
Expand Down

0 comments on commit 8b4cc83

Please sign in to comment.