xbudget.nodes.Term

class xbudget.nodes.Term(name, path, operations, explicit_var=None, optional=False)[source]

Bases: object

A node in a budget tree: a named quantity defined by its operations.

Parameters:
name

This term’s key under its parent (the budget side name for a root).

Type:

str

path

Full path of term names from the budget root, e.g. ("heat", "rhs", "diffusion", "lateral"). Used as the canonical identity and to derive output variable names.

Type:

tuple of str

operations

One or more of Sum/Product/Difference. The first sum/product operation provides the term’s primary value.

Type:

tuple of Operation

explicit_var

A pre-named output variable, if the recipe pinned one (rare).

Type:

str or None

optional

Declares this term’s diagnostics as expected to be absent on some datasets. When they are, the term is dropped silently — no warning, no on_missing="raise" error, and no xbudget_incomplete flag on the parent — instead of the loud “unexpectedly missing” treatment. This is the honest, self-documenting alternative to deleting the term from the recipe to quiet the warning. It suppresses missing-diagnostic alarms for the whole subtree rooted at this term.

Type:

bool

Methods

Attributes