RasterStats#

class RasterStats[source]#

Bases: object

__init__()[source]#

Methods

__init__()

compute(raster_sources[, sample_prob])

Compute the mean and stds over all the raster_sources.

load(stats_uri)

save(stats_uri)

__init__()[source]#
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
Return type

None

static load(stats_uri: str) None[source]#
Parameters

stats_uri (str) –

Return type

None

save(stats_uri: str) None[source]#
Parameters

stats_uri (str) –

Return type

None