[gdal-dev] python: setting nodata affects all bands

Frank Warmerdam warmerdam at pobox.com
Wed Dec 12 16:14:36 EST 2007


Matt Wilkie wrote:
> Hi Folks,
> 
> I'm endeavouring to teach myself a little about pythin and gdal by 
> working on a python script to set the nodata value on a raster. I've 
> encountered a puzzling thing and I don't know if this is expected 
> behaviour or I'm doing something wrong. If set nodata on a single band, 
> all of the bands are affected. For my current project this doesn't 
> matter, but it just doesn't seem right to me.
> 
> In the script below I expected band 1 to be changed and the others to 
> remain as they are.

Matt,

Conceptually each band has a distinct no data value.  However, in
practice, some drivers assume a common nodata value for all bands.  Was
this possibly a geotiff file you were operating on?  This could be
construed as a bug or at least a deficiency of the format driver you
were using.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list