mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #25734 -- Made GDALBand min and max properties use GDALComputeRasterStatistics.
Thanks Sergey Fedoseev and Tim Graham for the review.
This commit is contained in:
parent
2cb50f935a
commit
8f5904560a
5 changed files with 186 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue