display#
hydromodpy.display is the solver-agnostic figure layer. It wraps
matplotlib through a registered catalog of named figures consumable
from Run.plot, hmp display, and the [display] TOML
section.
Sub-modules#
display/figure.py–FigureSpecdataclass,FigureProtocol, andBaseFigureABC. Concrete figures inherit fromBaseFigureand decorate themselves with@register.display/catalog.py– registry,registerdecorator,get(name),list_figures(),names().display/figures/– one module per named figure. Auto-discovery throughpkgutil.iter_modulesindisplay/figures/__init__.py.display/geo/– shared geographic plotting helpers (basemaps, CRS-aware axes, scalebar, north arrow).display/overview/– composed overview report rendering used by the[overview]workflow.display/report_blocks/– shared static HTML block primitives used by block-based reports. It owns the generic dataclasses, renderer, level navigation, per-block level switches, relative artifact links, and missing-figure placeholders.display/catchment_report/– generic watershed report pipeline driven byhmp report catchmentand rendered throughdisplay/report_blocks.display/config.py–DisplayConfigPydantic model for the[display]TOML section.display/theme.py– shared style / colormap selection.
Block HTML Reports#
display/report_blocks is the common renderer for static reports
composed from reusable blocks. The key contract is that workflow code
builds ReportBlock objects, while the shared renderer writes the
HTML page. Domain-specific report modules should keep their scientific
logic in their own blocks.py files and call:
write_report_page(...)for one static page;write_report_page_with_block_variants(...)for a page where each block can switch betweencompact,standardandauditdetail.
The renderer is currently used by overview reporting, site-selection review reports, the catchment report pipeline, and the network/transient calibration diagnostic page.
Figure inventory (33 today)#
Spatial: piezometric_map, recharge_map, seepage_map,
concentration_map, side_by_side_map, difference_map,
cross_section, hydrographic_network,
hydrographic_network_comparison, simulated_active_network,
watershed_id_card, residuals.
Time series: hydrograph, hydrograph_sim_obs,
piezo_timeseries_sim_obs, duration_curve,
seasonal_boxplot, recession, ensemble_band.
Balance: water_budget.
Calibration: calibration_convergence,
calibration_landscape, calibration_objective_surface,
calibration_pairplot, calibration_posterior,
calibration_trace.
Hydrochemistry: piper_diagram, schoeller_diagram,
stiff_diagram.
Particle / scatter: particle_tracks, scatter_one_to_one.
Figure contract#
@dataclass(frozen=True)
class FigureSpec:
name: str
title: str
kind: str # "spatial" | "timeseries" | "balance" | "calibration" | ...
required_fields: tuple[str, ...]
required_tables: tuple[str, ...]
default_figsize: tuple[float, float]
class BaseFigure(ABC):
"""Implements plot() boilerplate (subplots + render + save)."""
spec: ClassVar[FigureSpec]
@abstractmethod
def render(self, sim: Run, ax: Axes, **opts) -> Axes: ...
The @register decorator places the class in the global registry
keyed by spec.name.
Key public symbols#
hydromodpy.display.{get, list_figures, names}hydromodpy.display.figure.{FigureSpec, BaseFigure}hydromodpy.display.catalog.registerhydromodpy.display.theme.plot_paramshydromodpy.display.config.DisplayConfighydromodpy.display.report_blocks.{ReportBlock, ReportMetric, ReportFigure, ReportTable, ReportLink}hydromodpy.display.report_blocks.{write_report_page, write_report_page_with_block_variants}
Recommended reading path#
hydromodpy/display/figure.pyfor the contract.hydromodpy/display/catalog.pyfor the registry.hydromodpy/display/figures/__init__.pyfor the auto-discovery.One simple figure such as
hydromodpy/display/figures/hydrograph.py.One spatial figure such as
hydromodpy/display/figures/piezometric_map.py.hydromodpy/display/report_blocks/model.pyandhydromodpy/display/report_blocks/html.pyfor the static HTML block contract.hydromodpy/display/catchment_report/builder.pyfor a complete block-based report producer.
Layer-matrix neighbours#
Allowed targets:
core,schema,results,display.Allowed sources:
analysis,reporting,workflow,projectandcli.displaymust not importdata,simulation,solver,calibration. Reach data throughRun(run.field,run.timeseries,run.budget).
See also#
Figure Catalog – user-facing figure catalog.
Add a Figure – step-by-step recipe.
Add a Block HTML Report – recipe for adding a block-based static HTML report.
results for the
RunAPI the figures consume.