From 5d4cd2fc460bb6ee61dc2091001714a6e42fc372 Mon Sep 17 00:00:00 2001 From: Romain Hugonnet Date: Fri, 8 Nov 2024 15:58:36 -0800 Subject: [PATCH] Unpin Rasterio<1.4 now that 2D xy/rowcol fixed (#615) --- dev-environment.yml | 2 +- environment.yml | 2 +- requirements.txt | 2 +- xdem/coreg/base.py | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dev-environment.yml b/dev-environment.yml index 12e54a93..fb682146 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 fc6901de..70613281 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 cbdd66cb..0d5001f8 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.* diff --git a/xdem/coreg/base.py b/xdem/coreg/base.py index c30a0fb6..7ebceb1a 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 = output.reshape(np.shape(raster_arr)) + return output