def statistics(self, refresh=False, approximate=False):
        # Prepare array with arguments for capi function
        smin, smax, smean, sstd = c_double(), c_double(), c_double(), c_double()
        stats_args = [
            self._ptr, c_int(approximate), byref(smin), byref(smax),
            byref(smean), byref(sstd), c_void_p(), c_void_p(),
        ]

        if refresh or self._stats_refresh:
            capi.compute_band_statistics(*stats_args)
        else:
            # Add additional argument to force computation if there is no
            # existing PAM file to take the values from.
            force = True
            stats_args.insert(2, c_int(force))
            capi.get_band_statistics(*stats_args)

        result = smin.value, smax.value, smean.value, sstd.value

        # Check if band is empty (in that case, set all statistics to None)
        if any((math.isnan(val) for val in result)):
            result = (None, None, None, None)

        self._stats_refresh = False

        return result
Changes the default_region setting.
dataset/ETHPy150Open django/django/django/contrib/gis/gdal/raster/band.py/GDALBand.statistics--crossover with--dataset/ETHPy150Open rackspace/pyrax/pyrax/__init__.py/set_default_region