From 94ede70d10e4f54cf81ba38117d48682aa9b64d0 Mon Sep 17 00:00:00 2001 From: "Alan D. Snow" Date: Mon, 3 Feb 2020 09:09:45 -0600 Subject: [PATCH] BUG: ensure band_key is list when iterating over bands for mask and scale (#87) --- docs/history.rst | 4 ++++ rioxarray/_io.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/history.rst b/docs/history.rst index f4260842..9b2c6889 100644 --- a/docs/history.rst +++ b/docs/history.rst @@ -1,6 +1,10 @@ History ======= +0.0.20 +------ +- BUG: ensure band_key is list when iterating over bands for mask and scale (pull #87) + 0.0.19 ------- - Add support for writing scales & offsets to raster (pull #79) diff --git a/rioxarray/_io.py b/rioxarray/_io.py index 63f4d499..2004dbce 100644 --- a/rioxarray/_io.py +++ b/rioxarray/_io.py @@ -160,7 +160,7 @@ def _getitem(self, key): if self.masked: out = np.ma.filled(out.astype(self.dtype), np.nan) if self.mask_and_scale: - for band in band_key: + for band in np.atleast_1d(band_key): band_iii = band - 1 out[band_iii] = ( out[band_iii] * riods.scales[band_iii]