diff options
| author | Daniel Wiesmann <daniel.wiesmann@gmail.com> | 2015-11-24 14:48:00 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-11-25 13:40:39 -0500 |
| commit | 8f5904560a7ab51d480410ca5228df1a28ec2295 (patch) | |
| tree | 9bca611eecd6f4a30064780f972385457523f122 /docs | |
| parent | 2cb50f935aa70e91dd6c2f253becd636a2eb6fb7 (diff) | |
Fixed #25734 -- Made GDALBand min and max properties use GDALComputeRasterStatistics.
Thanks Sergey Fedoseev and Tim Graham for the review.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/gis/gdal.txt | 43 | ||||
| -rw-r--r-- | docs/releases/1.10.txt | 5 |
2 files changed, 48 insertions, 0 deletions
diff --git a/docs/ref/contrib/gis/gdal.txt b/docs/ref/contrib/gis/gdal.txt index 2f3cb9f3d9..23728a354a 100644 --- a/docs/ref/contrib/gis/gdal.txt +++ b/docs/ref/contrib/gis/gdal.txt @@ -1413,6 +1413,35 @@ blue. The total number of pixels in this band. Is equal to ``width * height``. + .. method:: statistics(refresh=False, approximate=False) + + .. versionadded:: 1.10 + + Compute statistics on the pixel values of this band. The return value + is a tuple with the following structure: + ``(minimum, maximum, mean, standard deviation)``. + + If the ``approximate`` argument is set to ``True``, the statistics may + be computed based on overviews or a subset of image tiles. + + If the ``refresh`` argument is set to ``True``, the statistics will be + computed from the data directly, and the cache will be updated with the + result. + + If a persistent cache value is found, that value is returned. For + raster formats using Persistent Auxiliary Metadata (PAM) services, the + statistics might be cached in an auxiliary file. In some cases this + metadata might be out of sync with the pixel values or cause values + from a previous call to be returned which don't reflect the value of + the ``approximate`` argument. In such cases, use the ``refresh`` + argument to get updated values and store them in the cache. + + For empty bands (where all pixel values are "no data"), all statistics + are returned as ``None``. + + The statistics can also be retrieved directly by accessing the + :attr:`min`, :attr:`max`, :attr:`mean`, and :attr:`std` properties. + .. attribute:: min The minimum pixel value of the band (excluding the "no data" value). @@ -1421,6 +1450,20 @@ blue. The maximum pixel value of the band (excluding the "no data" value). + .. attribute:: mean + + .. versionadded:: 1.10 + + The mean of all pixel values of the band (excluding the "no data" + value). + + .. attribute:: std + + .. versionadded:: 1.10 + + The standard deviation of all pixel values of the band (excluding the + "no data" value). + .. attribute:: nodata_value The "no data" value for a band is generally a special marker value used diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt index 26e8849f3f..1c8b0b072d 100644 --- a/docs/releases/1.10.txt +++ b/docs/releases/1.10.txt @@ -74,6 +74,11 @@ Minor features * Added the :meth:`GEOSGeometry.covers() <django.contrib.gis.geos.GEOSGeometry.covers>` binary predicate. +* Added the :meth:`GDALBand.statistics() + <django.contrib.gis.gdal.GDALBand.statistics>` method and + :attr:`~django.contrib.gis.gdal.GDALBand.mean` + and :attr:`~django.contrib.gis.gdal.GDALBand.std` attributes. + :mod:`django.contrib.messages` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
