Filippo, Please note that those values are called nodata values.
Nodata value is assigned a specific value during the creation of the raster and all the pixels where data is unavailable are assigned that value. Using the python interface, you can find the specified value with GetNoDataValue(). You can compare it with "None" to check if a value is set. if band.GetNoDataValue() != None: print band.GetNoDataValue() else: print 'nodata not set' You cannot reset all the nodata pixels of a raster band directly. You can create a VRT file to do this. The VRT driver can translate the nodata value from the underlying dataset to the value you specify with <NoDataValue>99</NoDataValue>. http://www.gdal.org/gdal_vrttut.html On Fri, Jul 30, 2010 at 11:44 AM, Filippo Corò <filippo.c...@alice.it>wrote: > > Hi List, > > I'm running tests with GDAL 1.7 and python for achieving a function for > the sum of GeoTIFF file. I found some difficulty in handling null values. > I wanted to know if you can assign a specific value (like 99) to null when > I call the Open function. > > The code is as follows: > > # Open the image 1 > primoDs=gdal.Open('eros.tif', GA_ReadOnly) > > primoBand=primoDs.GetRasterBand(1) > > If I use the following function: > > noval=primoBand.GetNoDataValue() > print noval > > I get: > > 0.0 with null value: > > Is there any statement at this stage allow me to decide what value to > assign to null, when I call gdal.open? > > Thanks in Advance > > Filippo Corò > > > -- > Creato con il rivoluzionario client e-mail di Opera: > http://www.opera.com/mail/ > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/gdal-dev > -- Best regards, Chaitanya kumar CH. /tʃaɪθənjə/ /kʊmɑr/ +91-9494447584 17.2416N 80.1426E
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev