thermostrife.constants

Shared configuration: era bins, baseline window, Wong palette, paths, and the save_figure triple-output helper.

.. py:module:: thermostrife.constants

Shared configuration: era bins, station lookup, palette, paths.

.. py:data:: SEMANTIC_COLOURS :module: thermostrife.constants :type: dict[str, str] :value: {‘anti_heat’: ‘#CC79A7’, ‘control’: ‘#56B4E9’, ‘event’: ‘#D55E00’, ‘indoor’: ‘#009E73’, ‘north_hemi’: ‘#0072B2’, ‘null’: ‘#000000’, ‘outdoor’: ‘#E69F00’, ‘south_hemi’: ‘#F0E442’}

Semantic role mapping used across all ThermoStrife figures.

.. py:data:: TIER_COLOURS :module: thermostrife.constants :type: dict[str, str] :value: {‘tier1_ghcn’: ‘#009E73’, ‘tier2_hadcet_max’: ‘#56B4E9’, ‘tier2_hadcet_mean’: ‘#56B4E9’, ‘tier3_era5’: ‘#E69F00’, ‘tier4_20crv3’: ‘#CC79A7’}

Source-tier colours, applied per-event in scatter / strip plots. Ordered by historical reach: green (modern stations) → purple (deep historical reanalysis).

.. py:data:: TIER_LABELS :module: thermostrife.constants :type: dict[str, str] :value: {‘tier1_ghcn’: ‘Tier 1 — GHCN / meteostat’, ‘tier2_hadcet_max’: ‘Tier 2 — HadCET (Tmax)’, ‘tier2_hadcet_mean’: ‘Tier 2 — HadCET (mean)’, ‘tier3_era5’: ‘Tier 3 — ERA5 reanalysis’, ‘tier4_20crv3’: ‘Tier 4 — 20CRv3 reanalysis’}

Human-readable labels for legends, keyed by provenance code.

.. py:class:: ProvenanceTier(code: ‘str’, label: ‘str’, rank: ‘int’) :module: thermostrife.constants

Bases: :py:class:object

.. py:attribute:: ProvenanceTier.code :module: thermostrife.constants :type: str

.. py:attribute:: ProvenanceTier.label :module: thermostrife.constants :type: str

.. py:attribute:: ProvenanceTier.rank :module: thermostrife.constants :type: int

.. py:function:: save_figure(fig: Figure, stem: str, output_dir: Path, data_csv: pd.DataFrame | None = None, dpi: int = 200) -> None :module: thermostrife.constants

Export figure as SVG + PNG with optional CSV data companion.

:param fig: Matplotlib figure to save. :param stem: Filename stem (no extension). :param output_dir: Target directory (created if needed). :param data_csv: Optional DataFrame written alongside as <stem>.csv. :param dpi: Raster DPI for the PNG (default FIGURE_DPI).