From 4340c42a96482168c41e33dacb6c657c23665486 Mon Sep 17 00:00:00 2001 From: pmallas <6051395+pmallas@users.noreply.github.com> Date: Thu, 31 Oct 2019 12:15:17 -0400 Subject: [PATCH] Add boolean keyword recalc_transform to to_raster() to turn transform recalculation on/off MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a keyword that would allow user to turn off the recalculation of the transform in to_raster(). Currently, the tranform is always recalculated. Proposed change: def to_raster( … recalc_transform=True …) and with rasterio.open( .... transform=self.transform(recalc=recalc_transform) ...) --- rioxarray/rioxarray.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rioxarray/rioxarray.py b/rioxarray/rioxarray.py index 9b09ad2d..af942e1b 100644 --- a/rioxarray/rioxarray.py +++ b/rioxarray/rioxarray.py @@ -1100,6 +1100,7 @@ def to_raster( dtype=None, tags=None, windowed=False, + recalc_transform=True, **profile_kwargs, ): """ @@ -1165,7 +1166,7 @@ def to_raster( count=count, dtype=dtype, crs=self.crs, - transform=self.transform(recalc=True), + transform=self.transform(recalc=recalc_transform), nodata=( self.encoded_nodata if self.encoded_nodata is not None else self.nodata ),