Skip to content

ExpressionProcessor

Bases: IDMixin

Tiles processor that computes a new channel from an expression

Experimental

ExpressionProcessor is experimental since 1.3.0 and may change without notice.

Additional dependencies

ExpressionProcessor requires the expression dependency group.

Notes
  • Requires raster channels

Implements the TilesProcessor protocol.

PARAMETER DESCRIPTION
expression_string

Expression string based on the numexpr expression syntax

TYPE: str

new_channel_name

New channel name

TYPE: ChannelName | str

max_num_threads

Maximum number of threads

TYPE: int | None DEFAULT: None

id property

RETURNS DESCRIPTION
uuid.UUID

ID

from_config classmethod

Creates an expression processor from the configuration.

PARAMETER DESCRIPTION
config

Configuration

TYPE: ExpressionProcessorConfig

RETURNS DESCRIPTION
ExpressionProcessor

Expression processor

__call__

Computes the new channel from the expression.

PARAMETER DESCRIPTION
tiles

Tiles

TYPE: Tiles

RETURNS DESCRIPTION
Tiles

Tiles


ExpressionProcessorConfig

Bases: pydantic.BaseModel

Configuration for the from_config class method of ExpressionProcessor

Create the configuration from a config file
  • Use null instead of None
Usage

You can create the configuration from a config file.

config.yaml
package: 'aviary'
name: 'ExpressionProcessor'
config:
  expression_string: '(nir - r) / (nir + r)'
  new_channel_name: 'ndvi'
  max_num_threads: null
ATTRIBUTE DESCRIPTION
expression_string

Expression string based on the numexpr expression syntax

TYPE: str

new_channel_name

New channel name

TYPE: ChannelName | str

max_num_threads

Maximum number of threads - defaults to None

TYPE: int | None