[gdal-dev] What Statistics Are Returned By GDAL.Dataset.GetRasterBand(...).GetStatistics(...) ?

Even Rouault even.rouault at spatialys.com
Thu Oct 3 11:31:51 PDT 2019


On jeudi 3 octobre 2019 10:21:58 CEST Peter Willis wrote:
> Hello,
> 
> I am using osgeo.gdal  python module  to load and get stats from image
> bands.
> 
> While working with the, python, 'GetStatistics(...)' function I noticed that
> the returned values seemed a bit off.
> A snippet of code is shown below.

GDAL statistics take into account the nodata value (more exactly pixel whose 
value equals the nodata value are ignored from the statistics). That might 
explain the differences regarding the min, if 0 was the nodata value. But you 
also get differences for the max value

Can you paste the output of gdalinfo on such a file ?

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list