RasterStats#
- class RasterStats[source]#
Bases:
object
Methods
__init__
()compute
(raster_sources[, sample_prob])Compute the mean and stds over all the raster_sources.
load
(stats_uri)save
(stats_uri)- compute(raster_sources: Sequence[RasterSource], sample_prob: Optional[float] = None) None [source]#
Compute the mean and stds over all the raster_sources.
This ignores NODATA values.
If sample_prob is set, then a subset of each scene is used to compute stats which speeds up the computation. Roughly speaking, if sample_prob=0.5, then half the pixels in the scene will be used. More precisely, the number of chips is equal to sample_prob * (width * height / 300^2), or 1, whichever is greater. Each chip is uniformly sampled from the scene with replacement. Otherwise, it uses a sliding window over the entire scene to compute stats.
- Parameters
raster_sources (Sequence[RasterSource]) – list of RasterSource
sample_prob (Optional[float]) – (float or None) between 0 and 1
- Return type
None