From 9d7c70402b012611ca3d4fee9e9f938e245af9f1 Mon Sep 17 00:00:00 2001 From: Rafael Schouten Date: Wed, 13 Nov 2024 23:17:04 +0100 Subject: [PATCH] bugfix --- src/methods/zonal.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/methods/zonal.jl b/src/methods/zonal.jl index 42529c1a..1263a0ac 100644 --- a/src/methods/zonal.jl +++ b/src/methods/zonal.jl @@ -84,7 +84,7 @@ _zonal(f, x::Raster, of::Extents.Extent; skipmissing=true) = function _zonal(f, x::RasterStack, ext::Extents.Extent; skipmissing=true) cropped = crop(x; to=ext, touches=true) prod(size(cropped)) > 0 || return missing - return map(cropped) do A + return maplayers(cropped) do A _maybe_skipmissing_call(f, A, skipmissing) end end @@ -107,7 +107,7 @@ function _zonal(f, st::AbstractRasterStack, ::GI.AbstractGeometryTrait, geom; skipmissing=true, kw... ) cropped = crop(st; to=geom, touches=true) - prod(size(cropped)) > 0 || return map(_ -> missing, st) + prod(size(cropped)) > 0 || return map(_ -> missing, layerdims(st)) masked = mask(cropped; with=geom, kw...) return maplayers(masked) do A prod(size(A)) > 0 || return missing