Developer Guide: pcmdi_diags

This page describes how the PCMDI-related CLI entry points are implemented. For the runtime parameters and command behavior, see pcmdi_diags.

Implementation map

The PCMDI interface is split across several CLI entry points:

  • link_observation.py handles observation discovery, linking, and limited derived-variable generation.

  • pcmdi_mean_cimate.py runs mean-climate diagnostics and reorganizes the resulting outputs.

  • pcmdi_variability_modes.py runs variability-mode diagnostics and collects the resulting files.

  • pcmdi_enso.py defines the intended ENSO interface, but main() still exits early because the command is not yet supported.

  • pcmdi_synthetic_plots.py builds summary plots and the combined viewer pages from prior diagnostics output.

Shared setup path

zi-pcmdi-mean-climate, zi-pcmdi-variability-modes, and zi-pcmdi-enso all start by calling zppy_interfaces.pcmdi_diags.pcmdi_setup:

  1. Each CLI parses its command-specific arguments plus the shared core arguments.

  2. CoreParameters stores the shared values needed by downstream commands.

  3. set_up() resolves the reference data source, builds catalogue JSON files, optionally generates land-sea masks, and returns a CoreOutput object with reusable path templates and observation metadata.

  4. The calling CLI then generates command lists or viewer inputs using that shared setup result.

Command-specific flows

Mean climate

  1. Parse arguments and run the shared setup.

  2. Save regions.json for variable-to-region mapping.

  3. Build one mean_climate_driver.py command per supported variable.

  4. Execute those commands in serial or parallel mode.

  5. Use MeanClimateMetricsCollector to move figures, metrics JSON files, and NetCDF diagnostics into the results_dir structure expected by later stages.

Variability modes

  1. Parse arguments and run the shared setup.

  2. Build one variability_modes_driver.py command per requested mode.

  3. Execute those commands in serial or parallel mode.

  4. Reorganize graphics, metrics, and diagnostics into the structured output tree used by the viewer layer.

Synthetic plots and viewer

  1. Parse SyntheticPlotsParameters in pcmdi_synthetic_plots.py.

  2. Read synthetic_metrics_list.json and generate summary figures through SyntheticMetricsPlotter.

  3. Build the viewer configuration with helper functions from zppy_interfaces.pcmdi_diags.viewer.

  4. Write the methodology, data, and viewer HTML pages under web_dir/results_dir/viewer.