Filippo,<br><br>Please note that those values are called nodata values.<br><br>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.<br>
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.<br><br><span style="font-family: courier new,monospace;">if band.GetNoDataValue() != None:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> print band.GetNoDataValue()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> print 'nodata not set'</span><br style="font-family: courier new,monospace;"><br>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>. <a href="http://www.gdal.org/gdal_vrttut.html">http://www.gdal.org/gdal_vrttut.html</a><br>
<br><div class="gmail_quote">On Fri, Jul 30, 2010 at 11:44 AM, Filippo Corò <span dir="ltr"><<a href="mailto:filippo.coro@alice.it" target="_blank">filippo.coro@alice.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi List,<br>
<br>
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.<br>
I wanted to know if you can assign a specific value (like 99) to null when I call the Open function.<br>
<br>
The code is as follows:<br>
<br>
# Open the image 1<br>
primoDs=gdal.Open('eros.tif', GA_ReadOnly)<br>
<br>
primoBand=primoDs.GetRasterBand(1)<br>
<br>
If I use the following function:<br>
<br>
noval=primoBand.GetNoDataValue()<br>
print noval<br>
<br>
I get:<br>
<br>
0.0 with null value:<br>
<br>
Is there any statement at this stage allow me to decide what value to assign to null, when I call gdal.open?<br>
<br>
Thanks in Advance<br>
<br>
Filippo Corò<br><font color="#888888">
<br>
<br>
-- <br>
Creato con il rivoluzionario client e-mail di Opera: <a href="http://www.opera.com/mail/" target="_blank">http://www.opera.com/mail/</a><br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br>/tʃaɪθənjə/ /kʊmɑr/ <br>+91-9494447584<br>17.2416N 80.1426E<br>