Skip to content

Commit

Permalink
n
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Dec 18, 2024
1 parent 3ef6016 commit f326640
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- `expanse<SpatRaster>(transform=TRUE)` crashed R when the crs was "local". [#1671](https://github.com/rspatial/terra/issues/1671) by Michael Chirico
- `patches(values=TRUE)` wrapped around the edges [#1675](https://github.com/rspatial/terra/issues/1675) by Michael Chirico
- `spin` now correctly handles spherical coordinates [#1576](https://github.com/rspatial/terra/issues/1576) by jeanlobry
- `mosaic` sometimes crashed R [#1524](https://github.com/rspatial/terra/issues/1524) by John Baums, Dave Klinges, and Hugh Graham.
- `spatSample` ignored argument "exp" when taking a random sample with na.rm=TRUE on a large raster [#1437](https://github.com/rspatial/terra/issues/1437) by Babak Naimi

## enhancements

Expand All @@ -14,9 +16,10 @@
## new

- `$<SpatRaster>` can now be used to get a categorical SpatRaster with a different active category
- `scale_linear<SpatRaster>` method for linear scaling between e.g., 0 and 1
- `scale_linear<SpatRaster>` method for linear scaling of cell values between a minumum and maximum value such as 0 and 1
- `distance` and related methods get argument "method" to choose the distance algorithm for lon/lat data [#1677](https://github.com/rspatial/terra/issues/1677) by Márcia Barbosa


# version 1.8-5

Released 2024-12-12
Expand Down
22 changes: 13 additions & 9 deletions R/aggregate.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,24 @@
setMethod("aggregate", signature(x="SpatRaster"),
function(x, fact=2, fun="mean", ..., cores=1, filename="", overwrite=FALSE, wopt=list()) {

fun <- .makeTextFun(fun)
toc <- FALSE
if (inherits(fun, "character")) {
if (fun %in% c("sum", "mean", "min", "max", "median", "modal","prod", "which.min", "which.max",
"any", "all", "sd", "std", "sdpop")) {
fun[fun == "sdpop"] <- "std"
toc <- TRUE
if (hasValues(x)) {
fun <- .makeTextFun(fun)
toc <- FALSE
if (inherits(fun, "character")) {
if (fun %in% c("sum", "mean", "min", "max", "median", "modal","prod", "which.min", "which.max",
"any", "all", "sd", "std", "sdpop")) {
fun[fun == "sdpop"] <- "std"
toc <- TRUE
} else {
fun <- match.fun(fun)
}
} else {
fun <- match.fun(fun)
}
} else {
fun <- match.fun(fun)
toc = TRUE
fun = "mean"
}
if (!hasValues(x)) { toc = TRUE }
if (toc) {
# fun="mean", expand=TRUE, na.rm=TRUE, filename=""
narm <- isTRUE(list(...)$na.rm)
Expand Down

0 comments on commit f326640

Please sign in to comment.