rafaqz / Rasters.jl

Raster manipulation for the Julia language
MIT License
209 stars 36 forks source link

match to-dims with resample #657

Closed tiemvanderdeure closed 4 months ago

tiemvanderdeure commented 5 months ago

This PR ensures that the x and to have the same dimensions after resampling, if only to is provided.

Using size rather than resolution as a fallback means floating point error does not affect the outcome.

If only to is provided, the dimensions of the resampled raster will be set exactly match the dimensions of to.

rafaqz commented 4 months ago

Maybe we are not dropping the band dimension properly, that should happen in warp but maybe isn't?

Usually we check if there was a band in the original raster and dropdims(rast, Band()) if not.

tiemvanderdeure commented 4 months ago

No the problem was setting the dims to dims(to) without checking if there were other dims than just X/Y

tiemvanderdeure commented 4 months ago

Finally got tests to pass!