toad.utils.repr_html¶
Helpers for HTML representation of the TOAD object.
Used by TOAD._repr_html_() to build the collapsible variable hierarchy.
Functions
|
Build a hierarchy dict mapping base vars to their shifts and cluster variables. |
Load the TOAD logo and return as base64-encoded HTML img tag, or empty string on failure. |
|
|
Render the variable hierarchy as HTML with collapsible sections. |
- toad.utils.repr_html.build_variable_hierarchy(base_vars, shift_vars, cluster_vars, data)¶
Build a hierarchy dict mapping base vars to their shifts and cluster variables.
- Parameters:
base_vars (list[str]) – List of base variable names.
shift_vars (list[str]) – List of shift variable names.
cluster_vars (list[str]) – List of cluster variable names.
data (xr.Dataset) – xarray Dataset containing the variables and their attributes.
- Returns:
{“shifts”: […], “clusters”: […]}}.
- Return type:
Dict of shape {base_var
- toad.utils.repr_html.load_toad_logo_html()¶
Load the TOAD logo and return as base64-encoded HTML img tag, or empty string on failure.
- Return type:
str
- toad.utils.repr_html.render_hierarchy_html(hierarchy, data)¶
Render the variable hierarchy as HTML with collapsible sections.
- Parameters:
hierarchy (dict) – Dict from build_variable_hierarchy().
data (xr.Dataset) – xarray Dataset (for cluster counts).
- Returns:
HTML string for the variable table, or empty string if hierarchy is empty.
- Return type:
str