rspatial/terra

resample()'s cubic and Lanczos window sizes are undocumented

Closed this issue · 1 comments

I'm extracting aligned samples from several rasters with different cell sizes and then standardizing them to one cell size with resample(). Because the rasters are large (hundreds of MB to tens of GB for the virtual rasters) and the standardization is to the smallest cell size, it's necessary to window the area of interest before resampling. I had a bug where the windows weren't necessarily quite large enough, resulting in resample() occasionally producing NAs at area of interest edges.

As part of fixing this, I noticed terra's resample() documentation doesn't state window size requirements for cubic and Lanczos. I'm guessing terra indirectly calls IRasterIO() with resample()'s method argument remapped to GDALRIOResampleAlg. Is this correct? If so, the result would be cubic and cubicspline use a 4x4 window and lanczos a 6x6.

This uses GDALwarp , but surely RasterIO uses the same underlying algo. I have added the window size to the docs (adding 1, as I think it should be 5x5 and 7x7). Thanks.