Loading CHANGELOG.md +2 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ release. --> ## [Unreleased] ### Fixed - Fixed a bug where scale and offset were not being read or applied to GeoDataset objects. ## [1.5.5]() ### Fixed Loading plio/io/io_gdal.py +7 −3 Original line number Diff line number Diff line Loading @@ -506,6 +506,10 @@ class GeoDataset(object): """ band = self.dataset.GetRasterBand(band) offset = band.GetOffset() offset = 0 if offset is None else offset scale = band.GetScale() scale = 1 if scale is None else scale if dtype is None: dtype = GDAL2NP_CONVERSION[band.DataType] Loading @@ -513,7 +517,7 @@ class GeoDataset(object): dtype = getattr(np, dtype) if not pixels: array = band.ReadAsArray().astype(dtype) array = (band.ReadAsArray().astype(dtype) + offset) * scale #if self.north_up == False: # array = np.flipud(array) else: Loading @@ -534,7 +538,7 @@ class GeoDataset(object): if ystart + ycount > ymax: ycount = ymax - ystart array = band.ReadAsArray(xstart, ystart, xcount, ycount).astype(dtype) array = (band.ReadAsArray(xstart, ystart, xcount, ycount).astype(dtype) + offset) * scale return array Loading Loading
CHANGELOG.md +2 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ release. --> ## [Unreleased] ### Fixed - Fixed a bug where scale and offset were not being read or applied to GeoDataset objects. ## [1.5.5]() ### Fixed Loading
plio/io/io_gdal.py +7 −3 Original line number Diff line number Diff line Loading @@ -506,6 +506,10 @@ class GeoDataset(object): """ band = self.dataset.GetRasterBand(band) offset = band.GetOffset() offset = 0 if offset is None else offset scale = band.GetScale() scale = 1 if scale is None else scale if dtype is None: dtype = GDAL2NP_CONVERSION[band.DataType] Loading @@ -513,7 +517,7 @@ class GeoDataset(object): dtype = getattr(np, dtype) if not pixels: array = band.ReadAsArray().astype(dtype) array = (band.ReadAsArray().astype(dtype) + offset) * scale #if self.north_up == False: # array = np.flipud(array) else: Loading @@ -534,7 +538,7 @@ class GeoDataset(object): if ystart + ycount > ymax: ycount = ymax - ystart array = band.ReadAsArray(xstart, ystart, xcount, ycount).astype(dtype) array = (band.ReadAsArray(xstart, ystart, xcount, ycount).astype(dtype) + offset) * scale return array Loading