exactextract.operation

Classes

Operation

Summarize of pixel values using a built-in function

PythonOperation

Summarize of pixel values using a Python function

Module Contents

class exactextract.operation.Operation(stat_name: str, field_name: str, raster: exactextract.raster.RasterSource, weights: exactextract.raster.RasterSource | None = None, options: Mapping | None = None)[source]

Summarize of pixel values using a built-in function

Defines a summary operation to be performed on pixel values intersecting a geometry. May return a scalar (e.g., weighted_mean), or a vector (e.g., coverage).

Parameters:
  • stat_name – Name of the stat. Refer to docs for options.

  • field_name – Name of the result field that is assigned by this Operation.

  • raster – Raster to compute over.

  • weights – Weight raster to use. Defaults to None.

  • options – Arguments used to control the behavior of an Operation, e.g. options={"q": 0.667} with stat_name = "quantile"

class exactextract.operation.PythonOperation(function: Callable, field_name: str, raster: exactextract.raster.RasterSource, weights: exactextract.raster.RasterSource | None)[source]

Summarize of pixel values using a Python function

Defines a summary operation to be performed on pixel values intersecting a geometry.

Parameters:
  • function – Function accepting either two arguments (if weights is None), or three arguments. The function will be called with arrays of equal length containing: - pixel values from raster (masked array) - cell coverage fractions - pixel values from weights (masked array)

  • field_name – Name of the result field that is assigned by this Operation.

  • raster – Raster to compute over.

  • weights – Weight raster to use. Defaults to None.