Skip to contents

Created by reduce_over(). op is normally one of the named reductions "sum", "mean", "min", "max", "prod", "median", "quantile", "sd", "var", "count", "any", "all": the planner needs op identity to decide algebraic decomposition and output dtype, and the executor maps it to the ops vocabulary. A CUSTOM reducer may instead be supplied as fn (a length-1 list holding an anvl function fn(x, dims) that collapses dims), with op = "custom"; the executor calls it directly. A custom reducer cannot be decomposed across spatial chunks, so it is supported over the t/band axes (each spatial chunk holds the full axis), not over x/y.

Usage

ReduceNode(
  id = integer(0),
  parents = integer(0),
  grid = GridSpec(),
  role = character(0),
  op = character(0),
  over = character(0),
  nan_rm = logical(0),
  fn = list()
)

Arguments

id

Integer node id (assigned by graph_add()).

parents

Integer ids of parent nodes (may be empty).

grid

Output GridSpec of this node.

role

Optional semantic role tag (e.g. "mask", set by mask()). Pure metadata: never read by the planner or executors; surfaced by draw() and plan_view().

op

Reduction name, e.g. "mean" (one of the names above), or "custom".

over

Names of dims to reduce over.

nan_rm

Skip NaN (nodata) values? (Named ops only; a custom fn handles NaN itself.)

fn

Length-0 (named op) or length-1 list holding a custom anvl reducer fn(x, dims).

Value

A ReduceNode.