From 71a8362d98ef002de7e32bef8f1ea013a6964b49 Mon Sep 17 00:00:00 2001 From: Sean Harkins Date: Mon, 24 Oct 2022 13:58:46 -0500 Subject: [PATCH] Fix scale and offset application when only one is available. (#183) --- stackstac/rio_reader.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stackstac/rio_reader.py b/stackstac/rio_reader.py index 226c455..fa3841d 100644 --- a/stackstac/rio_reader.py +++ b/stackstac/rio_reader.py @@ -401,8 +401,9 @@ def read(self, window: Window, **kwargs) -> np.ndarray: if self.rescale: scale, offset = reader.scale_offset - if scale != 1 and offset != 0: + if scale != 1: result *= scale + if offset != 0: result += offset result = result.astype(self.dtype, copy=False)