Re: Any way to get/set the raster band scale and offset?

Sean Gillies
 

Hi Kris,

Raster scale and offset don't surface in Rasterio versions 1.0.9 and older only because no user has spoken up them. I'd be happy to add these for 1.0.10.


On Mon, Oct 29, 2018 at 4:22 PM Kris Vanhoof <kris.vanhoof@...> wrote:
Hi! I am using rasterio to convert a number of geotiffs that were originally
created using GDAL.  To preserve the image metadata I'm currently using a combination of
the 'profile', 'descriptions' and 'units' properties of DatasetBase as well as 'tags()'.

However, it is unclear to me how to get and set the 'Scale' and 'Offset' value for a raster band.

Since there is a 'units' property in 'DatasetBase', I would have expected there to be a 'scales' and 'offsets'.

Likewise, in 'DatasetWriterBase' there is a 'set_band_unit()', but no 'set_band_offset()' or 'set_band_scale()'.

The GDAL functions that I would normally use are:

GDALGetRasterUnitType()
GDALGetRasterScale()
GDALGetRasterOffset()

GDALSetRasterUnitType()
GDALSetRasterScale()
GDALSetRasterOffset()

Is there any way to access these values using rasterio?



--
Sean Gillies

Join main@rasterio.groups.io to automatically receive all group messages.