Skip to content

Commit

Permalink
add modal to mosaic
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Oct 17, 2023
1 parent e57b96d commit 49ede15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion man/mosaic.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This method is similar to the simpler, but much faster, \code{\link{merge}} meth
\item{x}{SpatRaster}
\item{y}{object of same class as \code{x}}
\item{...}{additional SpatRasters}
\item{fun}{character. One of "sum", "mean", "median", "min", "max"}
\item{fun}{character. One of "mean", "median", "min", "max", "modal", "sum", "first", "last"}
\item{filename}{character. Output filename}
\item{overwrite}{logical. If \code{TRUE}, \code{filename} is overwritten}
\item{wopt}{list with named options for writing files as in \code{\link{writeRaster}}}
Expand Down
3 changes: 2 additions & 1 deletion src/raster_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3439,11 +3439,12 @@ bool overlaps(const std::vector<unsigned>& r1, const std::vector<unsigned>& r2,
SpatRaster SpatRasterCollection::mosaic(std::string fun, SpatOptions &opt) {

SpatRaster out;
std::vector<std::string> f {"first", "last", "sum", "mean", "median", "min", "max"};
std::vector<std::string> f {"first", "last", "sum", "mean", "median", "min", "max", "modal"};
if (std::find(f.begin(), f.end(), fun) == f.end()) {
out.setError("argument 'fun' is not a valid function name");
return out;
}

if (fun == "first") {
return merge(true, true, opt);
}
Expand Down

0 comments on commit 49ede15

Please sign in to comment.