Hi, Thank you all for your answers. This was probably a bug in debian lenny: python-gdal in lenny is 1.5.2-3 python-gdal in squeeze is 1.5.4-2
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. Oz. On Fri, Feb 27, 2009 at 5:40 PM, Frank Warmerdam <[email protected]>wrote: > Oz Nahum wrote: > >> Hi, Thanks for the answer. >> Ok, I admit the way I presented my first email is a bit confusing. >> 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. >> raster2.asc and looks like this: >> >> in text editor: >> |ncols 6 >> nrows 4 >> xllcorner 3366820.0000019 >> yllcorner 5814589.0300007 >> cellsize 10 >> NODATA_value -9999 >> 1 1 1 1 1 1 >> 1 1 1 1 1 1 >> 1 1 1 1 1 1 >> 1 1 1 1 -9999 -9999| >> >> |in python: >>> dataset = gdal.Open('raster1.asc', GA_ReadOnly) >> >>> a = gdal_array.DatasetReadAsArray(dataset) >> >>> a >> array([[ 1, 1, 1, 1, 1, 1], >> [ 1, 1, 1, 1, 1, 1], >> [ 1, 1, 1, 1, 1, 1], >> [ 1, 1, 1, 1, -9999, 31081]], dtype=int16) >> > > Oz, > > I'm not seeing this behavior on my system: > > >>> a = gdalnumeric.DatasetReadAsArray(ds) > >>> print a > [[ 1 1 1 1 1 1] > [ 1 1 1 1 1 1] > [ 1 1 1 1 1 1] > [ 1 1 1 1 -9999 -9999]] > > I'd suggest filing a ticket on the issue and being very specific > about the operating system platform, and GDAL version you are using. > Also, make sure you zip and attach the grid file in case there is some > issue with missing final newline or something that is having an influence. > > Best regards, > -- > > ---------------------------------------+-------------------------------------- > I set the clouds in motion - turn up | Frank Warmerdam, > [email protected] > light and sound - activate the windows | > http://pobox.com/~warmerdam<http://pobox.com/%7Ewarmerdam> > and watch the world go round - Rush | Geospatial Programmer for Rent > > -- when one person suffers from a delusion it is called insanity. When many people suffer from a delusion it is called religion." Robert Pirsig, Zen and the Art of Motorcycle Maintenance
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
