[gdal-dev] NODATA value in an array from RasterIO
Frank Warmerdam
warmerdam at pobox.com
Tue Mar 25 14:56:28 EDT 2008
Limei Ran wrote:
>
> Hi:
>
> I am reading a region out from a band using RaterIO into an array. What
> are NODATA cell values in the array? Are they 0 or something else? Can
> I modify the array and write back to the image. How do I keep NODATA
> values in the array to be on the image after writing?
Limei,
Nodata cells will have some particular pixel value. You can use the
GetNoDataValue() method on a gdal.Band object to determine what it's
nodata pixel value is. It should be None if there is no reserved
nodata pixel value.
How to preserve nodata pixels depends on the circumstances. Is your
concern keeping nodata pixels unchanged through a series of arithmetic
operations on the image array? Or setting the "nodata metadata" properly
on the output dataset?
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