Skip to content

Commit

Permalink
temporal brick only when ncol matches
Browse files Browse the repository at this point in the history
  • Loading branch information
seanhaythorne committed Mar 4, 2021
1 parent 9ed2238 commit 6df6d9d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/PaleoRegion.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ PaleoRegion <- R6Class("PaleoRegion",
#' @return A \emph{RasterLayer} (or \emph{RasterStack/Brick}) object consistent with the region raster with temporal mask (if any) applied.
raster_from_values = function(values) {
value_raster <- super$raster_from_values(values)
if (!is.null(self$temporal_mask)) {
if (!is.null(self$temporal_mask) && ncol(as.matrix(values)) == ncol(self$temporal_mask)) {
value_raster[self$region_indices] <- value_raster[self$region_indices]*(self$temporal_mask | NA)
}
return(value_raster)
Expand Down

0 comments on commit 6df6d9d

Please sign in to comment.