[gdal-dev] python-gdal ComputStatistics return just two values

Lucena, Ivan ivan.lucena at pmldnet.com
Fri Mar 27 14:02:14 EDT 2009


Hi there,

I believe that ComputeBandStats() should return 4 values min, max, mean and stddev) [1] but the Python API is 
returning just mean and stddev.

python:

>>> bd.ComputeBandStats()
(9.0071713001936118, 11.350094331448236)
>>> bd.ComputeRasterMinMax()
(-1.7899999618530273, 31.149999618530273)

gdalinfo:

Band 1 Block=360x1 Type=Float32, ColorInterp=Gray
  Min=-1.790 Max=31.150
  Minimum=-1.790, Maximum=31.150, Mean=9.007, StdDev=11.350
  Unit Type: unspecified
  Metadata:
    STATISTICS_MINIMUM=-1.789999961853
    STATISTICS_MAXIMUM=31.14999961853
    STATISTICS_MEAN=9.0071713001936
    STATISTICS_STDDEV=11.350094331448

Is that a bug?

See what happens in that case:

>>> bd1.SetStatistics(bd2.ComputeBandStats())
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "E:\Python25\Lib\site-packages\osgeo\gdal.py", line 729, in SetStatistics
    return _gdal.Band_SetStatistics(*args)
TypeError: Band_SetStatistics() takes exactly 5 arguments (2 given)

My best regards,

Ivan

[1] http://www.gdal.org/gdal_8h.html#a93b6b6ea6e71017ce25524e1a9ef1e3



More information about the gdal-dev mailing list