Zonalstats.__init__

Zonalstats.__init__(stats: List[str], categorical: bool = False, valid_threshold: float = 0.0, area: bool = False, prefix: str | None = None, bands: List[int] = [1])[source]

Constructor

Parameters:
  • stats ([str]) – List of stats to compute. Zonalstats.valid_stats defined the list of valid stats except percentile which can be defined as string concatenating percentile_ with the percentile value (from 0 to 100).

  • categorical (bool, optional, default=False) – If true and input raster is “categorical”, add the counts of every unique raster values to the stats

  • valid_threshold (float, optional, default=0.0) – Minimum percentage of valid pixels in a shape to compute its statistics ([0.0, 1.0])

  • area (bool, optional, default=False) – If true, statistics are multiplied by the pixel area of the raster input

  • prefix (str, optional, default=None]) – Add a prefix to the stats keys, one prefix per band. The argument is a string with all prefixes separated by a space.

  • bands ([int], optional, default=[1]) – List of bands in the input image to process. Set None if all bands shall be processed.