Skip to content

Commit

Permalink
w
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Jun 21, 2023
1 parent 39aebdc commit 37924be
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/ncdf.R
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@
setMethod("writeCDF", signature(x="SpatRaster"),
function(x, filename, varname, longname="", unit="", split=FALSE, ...) {
filename <- trimws(filename)
if (length(filename) > 1) {
if (length(filename) != nlyr(x)) {
stop("either provide a single filename, or the same number as nlyr(x)")
}
}
stopifnot(filename != "")
if (split) {
y <- sds(as.list(x))
Expand Down

0 comments on commit 37924be

Please sign in to comment.