pycsa.plotting.diagnostics

Per-cell diagnostic plotting shared by the global run and the examples.

A single source of truth for the 3-panel per-cell figure (loaded topography / second-approximation reconstruction / amplitude spectrum) and the ocean-aware topography colormap, so that runs/icon_etopo_global.py and the bundled examples produce identical figures.

Functions

get_topo_colormap()

Create a topography colormap with blue for ocean (< 0m) and terrain colors for land (> 0m).

plot_cell_diagnostics(c_idx, cell_sa, ...[, ...])

Create 3-panel diagnostic plot for a single cell.

pycsa.plotting.diagnostics.get_topo_colormap()

Create a topography colormap with blue for ocean (< 0m) and terrain colors for land (> 0m). Transition occurs exactly at sea level (0m) with smooth blending.

For TwoSlopeNorm to work correctly, we need equal colors on each side: 120 colors for ocean (< 0m) + 16 transition colors + 120 colors for land (> 0m) = 256 total

pycsa.plotting.diagnostics.plot_cell_diagnostics(c_idx, cell_sa, ampls_sa, dat_2D_sa, output_dir, params, out_path=None, cell_label=None)

Create 3-panel diagnostic plot for a single cell.

Panel 1: Loaded topography (original ETOPO data within cell) Panel 2: Reconstructed topography after second approximation Panel 3: Computed spectrum

Parameters:
  • c_idx (int) – Cell index

  • cell_sa (topo_cell) – Cell object after second approximation (contains original topo in cell.topo)

  • ampls_sa (ndarray) – Amplitude spectrum from second approximation

  • dat_2D_sa (ndarray) – Reconstructed topography from second approximation

  • output_dir (Path) – Output directory for the default cell_{c_idx:05d}.png filename.

  • params (params object) – Parameters object

  • out_path (Path, optional) – Explicit output path; overrides output_dir / f"cell_{c_idx:05d}.png".

  • cell_label (str, optional) – Title prefix for panel 1; defaults to f"Cell {c_idx}".