postgkyl.evaluate

postgkyl.evaluate(chain, *datasets, tag=None, label=None)

Evaluate an RPN expression over an explicit list of datasets.

f/fN tokens in chain refer to datasets[N] (f == f0); see the module docstring for the token grammar. The result is built via datasets[0]._result(...) (so it stays the caller’s concrete dataset class) and holds the single value left on top of the stack.

Parameters:
  • chain – the RPN expression, e.g. "f0 f1 +" or "f sq 2 *".

  • *datasets – the datasets referenced positionally by the f/fN tokens. At least one is required (it anchors the result’s class).

  • tag – optional tag for the returned dataset (defaults to 'default').

  • label – optional label for the returned dataset (defaults to chain).

Returns:

A dataset holding the evaluated grid/values and the merged ctx.

Raises:

ValueError – if datasets is empty, the expression is empty, a token is unrecognized, or an operator fails.

CLI: evaluate