From 0aa61ecd2c0da84e70c2a5a2717013174d64df47 Mon Sep 17 00:00:00 2001 From: Gregory Halverson Date: Thu, 21 Nov 2024 21:47:02 -0800 Subject: [PATCH 1/2] fixing `shift_xy` --- rasters/raster_grid.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/rasters/raster_grid.py b/rasters/raster_grid.py index 3937392..335977a 100644 --- a/rasters/raster_grid.py +++ b/rasters/raster_grid.py @@ -537,10 +537,16 @@ def subset(self, target: Union[Window, Point, Polygon, BBox, RasterGeometry]) -> return subset def shift_xy(self, x_shift: float, y_shift: float) -> RasterGrid: - new_affine = self.affine * Affine.translation(x_shift, y_shift) - grid = RasterGrid.from_affine(new_affine, self.rows, self.cols, self.crs) - - return grid + cell_width = self.cell_width + cell_height = self.cell_height + x_origin = self.x_origin + x_shift + y_origin = self.y_origin + y_shift + shifted_x_origin = x_origin + x_shift + shifted_y_origin = y_origin + y_shift + shifted_affine = Affine(cell_width, 0, shifted_x_origin, 0, cell_height, shifted_y_origin) + shifted_grid = RasterGrid.from_affine(shifted_affine, self.rows, self.cols, self.crs) + + return shifted_grid def shift_distance(self, distance: float, direction: float) -> RasterGrid: x_shift = distance * np.cos(np.radians(direction)) From 5725f604a850aec68aa465c4b58f71b0db6e5fb0 Mon Sep 17 00:00:00 2001 From: Gregory Halverson Date: Thu, 21 Nov 2024 21:48:01 -0800 Subject: [PATCH 2/2] fixing `shift_xy` --- pyproject.toml | 2 +- rasters/version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 70922a0..2b993ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "rasters" -version = "1.4.0" +version = "1.4.1" description = "raster processing toolkit" readme = "README.md" authors = [ diff --git a/rasters/version.txt b/rasters/version.txt index e21e727..13175fd 100644 --- a/rasters/version.txt +++ b/rasters/version.txt @@ -1 +1 @@ -1.4.0 \ No newline at end of file +1.4.1 \ No newline at end of file