You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you.
Out of curiosity, has it been considered changing the error message when extents of x and y to not overlap, but extend=TRUE, into returning an empty raster with ext=y? Perhaps with a warning message.
library(terra)
#terra 1.7.24
r <- rast(nrow=10, ncol=10, extent=ext(0, 10, 0, 10))
e <- ext(-10, -5, -10, -5)
crop(r, e, extend=TRUE)
#Error: [crop] extents do not overlap
I can imagine a few cases where this behaviour would be useful, though it can obviously easily be circumvented using a prior check based on intersect(ext(r), e), or simply using crop(extend(r,e),e), though the latter is potentially very inefficient in cases with a large distance between ext(r) and e.
When using crop with a raster and an extend that goes beyond the raster, it returns the original raster when extend=TRUE.
I would have expected that it extends the cropped raster to have the extent of e, as with:
Is this the intended behaviour or a bug?
The text was updated successfully, but these errors were encountered: