Skip to content

Commit

Permalink
reset to DD v0.28 functions
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 committed Nov 13, 2024
1 parent d6a1d99 commit d81b595
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/methods/zonal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ function _zonal(f, x::RasterStack, ext::Extents.Extent; skipmissing=true, bylaye
cropped = crop(x; to=ext, touches=true)
prod(size(cropped)) > 0 || return missing
if bylayer # apply f to each layer
return maplayers(cropped) do A
return DD._maybestack(cropped, map(values(cropped)) do A
prod(size(A)) > 0 || return missing
_maybe_skipmissing_call(f, A, skipmissing)
end
end)
else # apply f to the whole stack
prod(size(cropped)) > 0 || return missing
return _maybe_skipmissing_call(f, cropped, skipmissing)
Expand Down Expand Up @@ -122,10 +122,10 @@ function _zonal(f, st::AbstractRasterStack, ::GI.AbstractGeometryTrait, geom;
prod(size(cropped)) > 0 || return map(_ -> missing, st)
masked = mask(cropped; with=geom, kw...)
if bylayer # apply f to each layer
return maplayers(masked) do A
return DD._maybestack(masked, map(values(masked)) do A # TODO: replace this with `maplayers` once DD v0.29 is available
prod(size(A)) > 0 || return missing
_maybe_skipmissing_call(f, A, skipmissing)
end
end)
else # apply f to the whole stack
prod(size(masked)) > 0 || return missing
return _maybe_skipmissing_call(f, masked, skipmissing)
Expand Down

0 comments on commit d81b595

Please sign in to comment.