raptorstats.stats module
- class raptorstats.stats.Stats(stats=None, categorical=False)[source]
Bases:
object
Configuration for statistics computation.
Stores the statistics to be computed and has methods for computing them from arrays or partial results.
- from_array(data: MaskedArray) dict [source]
Compute the configured statistics on data.
- Parameters:
data (np.ndarray or np.ma.MaskedArray) – Pixel values for one feature. Masked or NaN values are treated as nodata.
- Returns:
Keys are the statistic names requested at construction time (plus every {value: count} entry if categorical=True). Values are floats or ints; empty inputs yield None.
- Return type:
dict
- from_partials(partials: list[dict]) dict [source]
Combine already-computed chunk statistics into one feature-level dict.
Each element of partials must have been produced by from_array() with the same Stats configuration.
- Returns:
Feature-level statistics – exactly the same schema you get from calling from_array() on the full dataset at once.
- Return type:
dict