I would like to improve way to adjust histogram of Sentinel 2 images in Qgis 3. I am using pyqgis to do the first task to it (create histogram rightly). So I have images that 0 is a no data value. To set it I use this code: Set raster layer additional no data value with PyQgis
import processing self=qgis.utils layers = self.iface.mapCanvas().layers() path_save = '/home/diogocaribe/sld/' # Change o backgroud value for layer in layers: layerType = layer.type() if layerType == QgsMapLayer.RasterLayer: for band in range(1, layer.bandCount()+1): provider = layer.dataProvider() provider.setNoDataValue(band, 0) #first one is referred to band number layer.triggerRepaint()
So, the first thing that I have to do is create histogram. However, if I don't set 0 in additional no data value the histogram is created with different behavior:
When I defined additional no data value as 0 and recompute histogram it works well.
So I would like to fill the blank in proprieties layer using pyqgis in order to put additional no data field as 0 and fix the problem described above.