id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc 2083,gtiff driver not respecting separate nodata for each band,maphew,warmerdam,"The geotiff format driver assigns all bands the same nodata value, even if only a single band was specified with `bandN.SetNoDataValue` Also see http://www.nabble.com/python%3A-setting-nodata-affects-all-bands-td14303097.html {{{ ----- gdalsetnull.py ----- import gdal import sys import os.path if len(sys.argv) < 2: print ""Usage: gdalsetnull.py raster_file null_value"" sys.exit(1) input = sys.argv[1] null_value = sys.argv[2] dataset = gdal.Open( input, gdal.GA_Update ) if dataset is None: print 'Unable to open', input, 'for writing' sys.exit(1) b1 = dataset.GetRasterBand(1) b2 = dataset.GetRasterBand(2) b3 = dataset.GetRasterBand(3) print 'Initial nodata:\t', b1.GetNoDataValue(), b2.GetNoDataValue(), b3.GetNoDataValue() b1.SetNoDataValue( float(null_value) ) print 'Output nodata:\t', b1.GetNoDataValue(), b2.GetNoDataValue(), b3.GetNoDataValue() --------------------------- }}} Results: {{{ python gdalsetnull.py nodata-test.tif 0 Initial nodata: 46.0 46.0 46.0 Output nodata: 0.0 0.0 0.0 }}}",defect,closed,normal,,GDAL_Raster,unspecified,normal,fixed,gtiff,dron Even Rouault Mateusz Łoskot Kyle Shannon