statistics(refresh=False, approximate=False)
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 min
, max
, mean
, and std
properties.
Please login to continue.