xbudget.display¶
Human-friendly renderings of an xbudget recipe.
A recipe is a deeply nested provenance tree. Printed as raw JSON it is almost
unreadable; what a user actually wants is the shape — which terms sum into
which, what operation builds each, and (after a run) what each term is called in
the dataset. This module renders the typed tree (xbudget.nodes, via
xbudget.parse.parse_budgets()) rather than the raw dict, so it shows real
semantics (operator badges, scalars vs. diagnostics) and inherits the parser’s
tolerance of the malformed/placeholder nodes real recipes carry.
Two renderings, one walker:
_repr_html_— a collapsible tree of nested<details>/<summary>elements (native HTML5, no JavaScript), styled after xarray’sDatasetrepr so it feels at home in the same notebooks. Click an arrow to expand a level.__repr__— an indented├─/└─ASCII tree, for terminals and any context that does not render HTML.
Entry points:
show_recipe()— inspect a recipe offline (no dataset). Returns a small displayable object;show_recipe(recipe, "heat")scopes to one budget.xbudget.query.BudgetQuery._repr_html_()— the same tree, but annotated with each term’s resolved variable name and with unmaterialized terms greyed out, so displaying a query in a notebook shows structure and run state.
Functions
|
Render |
|
Render |
|
Display a recipe as a collapsible tree. |