<div dir="ltr">Hi, <br>Thank you all for your answers. <br>This was probably a bug in debian lenny: <br>python-gdal in lenny is 1.5.2-3<br>python-gdal in squeeze is 1.5.4-2 <br><br>This behavior does not occur in debian squeeze, so I will look up if a bug report on this exists in debian-lenny and report this internaly to the debian guys. <br>
<br>Oz. <br><br><div class="gmail_quote">On Fri, Feb 27, 2009 at 5:40 PM, Frank Warmerdam <span dir="ltr"><<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</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;">
<div class="im">Oz Nahum wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi, Thanks for the answer.<br>
Ok, I admit the way I presented my first email is a bit confusing.<br>
But the problem is not with the 'null' values. Rather the problem is with the raster containing the no data values as -9999. This is a no data representation like you said. My problem is that GDAL is converting the last -9999 value to this value 31081.<br>
raster2.asc and looks like this:<br>
<br>
in text editor:<br>
|ncols 6<br>
nrows 4<br>
xllcorner 3366820.0000019<br>
yllcorner 5814589.0300007<br>
cellsize 10<br>
NODATA_value -9999<br>
1 1 1 1 1 1<br>
1 1 1 1 1 1<br>
1 1 1 1 1 1<br>
1 1 1 1 -9999 -9999|<br>
<br>
|in python: >>> dataset = gdal.Open('raster1.asc', GA_ReadOnly)<br>
>>> a = gdal_array.DatasetReadAsArray(dataset)<br>
>>> a<br>
array([[ 1, 1, 1, 1, 1, 1],<br>
[ 1, 1, 1, 1, 1, 1],<br>
[ 1, 1, 1, 1, 1, 1],<br>
[ 1, 1, 1, 1, -9999, 31081]], dtype=int16)<br>
</blockquote>
<br></div>
Oz,<br>
<br>
I'm not seeing this behavior on my system:<br>
<br>
>>> a = gdalnumeric.DatasetReadAsArray(ds)<br>
>>> print a<br>
[[ 1 1 1 1 1 1]<div class="im"><br>
[ 1 1 1 1 1 1]<br>
[ 1 1 1 1 1 1]<br></div>
[ 1 1 1 1 -9999 -9999]]<br>
<br>
I'd suggest filing a ticket on the issue and being very specific<br>
about the operating system platform, and GDAL version you are using.<br>
Also, make sure you zip and attach the grid file in case there is some<br>
issue with missing final newline or something that is having an influence.<br>
<br>
Best regards,<br><font color="#888888">
-- <br>
---------------------------------------+--------------------------------------<br>
I set the clouds in motion - turn up | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>
light and sound - activate the windows | <a href="http://pobox.com/%7Ewarmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>
and watch the world go round - Rush | Geospatial Programmer for Rent<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br><br><br>when one person suffers from a delusion it is called insanity. When many people suffer from a delusion it is called religion."<br>Robert Pirsig, Zen and the Art of Motorcycle Maintenance<br>
<br>
</div>