fre.cmor.cmor_yamler module

YAML-Driven CMORization Workflow Tools

This module powers the fre cmor yaml command, steering the CMORization workflow by parsing model-YAML files that describe target experiments and their configurations. It combines model-level and experiment-level configuration, parses required metadata and paths, and orchestrates calls to cmor_run_subtool for each target variable/component.

Functions

  • cmor_yaml_subtool(...)

Note

“yamler” is a portmanteau of “yaml” and “reader”.

fre.cmor.cmor_yamler.cmor_yaml_subtool(yamlfile: str = None, exp_name: str = None, platform: str = None, target: str = None, output: str | None = None, opt_var_name: str | None = None, run_one_mode: bool = False, dry_run_mode: bool = False, start: str | None = None, stop: str | None = None, calendar_type: str | None = None, print_cli_call: bool = True)

Main driver for CMORization using model YAML configuration files. This routine parses the model YAML, combines configuration, resolves and checks all required paths and metadata, and orchestrates calls to cmor_run_subtool for each table/component/variable defined in the configuration.

Parameters:
  • yamlfile (str) – Path to a model-yaml file holding experiment and workflow configuration.

  • exp_name (str) – Experiment name (must be present in the YAML file).

  • platform (str) – Platform target (e.g., ‘ncrc4.intel’).

  • target (str) – Compilation target (e.g., ‘prod-openmp’).

  • output (str, optional) – filename for YAML output.

  • opt_var_name (str, optional) – If specified, process only files matching this variable name.

  • run_one_mode (bool) – If True, process only one file and exit.

  • dry_run_mode (bool) – If True, print configuration and actions without executing cmor_run_subtool.

  • start (str, optional) – Four-digit year (YYYY) indicating start of date range to process.

  • stop (str, optional) – Four-digit year (YYYY) indicating end of date range to process.

  • calendar_type (str, optional) – CF-compliant calendar type.

  • print_cli_call (bool) – When True and dry_run_mode is enabled, print the equivalent fre cmor run CLI invocation; when False, print the Python cmor_run_subtool(...) call instead.

Raises:
  • FileNotFoundError – If required paths do not exist.

  • OSError – If output directories cannot be created.

  • ValueError – If required configuration is missing or inconsistent.

Returns:

None

Return type:

None

Note

Reads and combines YAML and JSON configuration.

Note

Performs path, frequency, and gridding checks.

Note

Delegates actual CMORization to cmor_run_subtool, except in dry-run mode.

Note

All actions and key decisions are logged.