xdem icon indicating copy to clipboard operation
xdem copied to clipboard

Initial shift in case of CoregPipeline

Open marinebcht opened this issue 3 months ago • 1 comments

After merging this https://github.com/GlacioHack/xdem/pull/781 (initial shift for N&K) and moving all operations needed in base.py, a new problem emerges in case of CoregPipeline.

Indeed, we can use reference_elev = reference_elev.translate(-shift_x, -shift_y) as reference_elev was cast from DEM to array in _preprocess_coreg_fit_raster_raster.

@rhugonnet I am pointing you to the new ticket; if you could explain it to me in more detail the trick I need to use, that would be great :) Thank you

marinebcht avatar Oct 10 '25 08:10 marinebcht

@marinebcht Yes! We can import directly the underlying function _translate here: https://github.com/GlacioHack/geoutils/blob/8554fa410c647a3bf58f53a777439ab4d2cbc3ee/geoutils/raster/geotransformations.py#L232, which doesn't require a Raster but only the transform. (as no array is needed for a horizontal translation, just the relative geolocation; Raster.translate() also only updates the Raster.transform)

Then, we update the transform with this _translate in CoregPipeline :wink:

rhugonnet avatar Oct 10 '25 19:10 rhugonnet