From 6d17dde72d44d6054ebf2808fe94d0f37eaa34d5 Mon Sep 17 00:00:00 2001 From: Romain Hugonnet Date: Wed, 23 Oct 2024 16:29:44 -0800 Subject: [PATCH 1/3] Unpin Rasterio --- dev-environment.yml | 2 +- environment.yml | 2 +- requirements.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev-environment.yml b/dev-environment.yml index e17b7561..848ee9e3 100644 --- a/dev-environment.yml +++ b/dev-environment.yml @@ -8,7 +8,7 @@ dependencies: - numpy=1.* - matplotlib=3.* - pyproj>=3.4,<4 - - rasterio>=1.3,<1.4 + - rasterio>=1.3,<2 - scipy=1.* - tqdm - scikit-image=0.* diff --git a/environment.yml b/environment.yml index cd855041..8f5279c5 100644 --- a/environment.yml +++ b/environment.yml @@ -8,7 +8,7 @@ dependencies: - numpy=1.* - matplotlib=3.* - pyproj>=3.4,<4 - - rasterio>=1.3,<1.4 + - rasterio>=1.3,<2 - scipy=1.* - tqdm - scikit-image=0.* diff --git a/requirements.txt b/requirements.txt index 6fced653..98df6ee8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ numba==0.* numpy==1.* matplotlib==3.* pyproj>=3.4,<4 -rasterio>=1.3,<1.4 +rasterio>=1.3,<2 scipy==1.* tqdm scikit-image==0.* From 62f7316276b1d53fb8baa4cf76f8bd3abc9ffc32 Mon Sep 17 00:00:00 2001 From: Romain Hugonnet Date: Fri, 8 Nov 2024 13:54:06 -0900 Subject: [PATCH 2/3] Fix input shape since Rasterio 1.4 --- xdem/coreg/base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xdem/coreg/base.py b/xdem/coreg/base.py index c30a0fb6..092459cf 100644 --- a/xdem/coreg/base.py +++ b/xdem/coreg/base.py @@ -1314,6 +1314,8 @@ def _reproject_horizontal_shift_samecrs( # force any pixel interpretation (area_or_point) without it having any influence on the result, here "Area" if not return_interpolator: coords_dst = _coords(transform=dst_transform, area_or_point="Area", shape=raster_arr.shape) + # Flatten the arrays (only 1D supported in rowcol/xy after Rasterio 1.4) + coords_dst = (coords_dst[0].ravel(), coords_dst[1].ravel()) # If we just want the interpolator, we don't need to coordinates of destination points else: coords_dst = None @@ -1327,6 +1329,10 @@ def _reproject_horizontal_shift_samecrs( return_interpolator=return_interpolator, ) + # Reshape output + if coords_dst is not None: + output.reshape(raster_arr) + return output From e8ceb44b18330c41a1c794a0d58ee5c74a7c7507 Mon Sep 17 00:00:00 2001 From: Romain Hugonnet Date: Fri, 8 Nov 2024 14:16:39 -0900 Subject: [PATCH 3/3] Fix reshape --- xdem/coreg/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xdem/coreg/base.py b/xdem/coreg/base.py index 092459cf..7ebceb1a 100644 --- a/xdem/coreg/base.py +++ b/xdem/coreg/base.py @@ -1331,7 +1331,7 @@ def _reproject_horizontal_shift_samecrs( # Reshape output if coords_dst is not None: - output.reshape(raster_arr) + output = output.reshape(np.shape(raster_arr)) return output