fremor.cmor_init module

fremor init: CMOR config initialization

This module powers the fremor init command, providing two key capabilities:

  1. Experiment config template generation – writes an empty (template) JSON experiment configuration file for either CMIP6 or CMIP7. The user fills in the placeholder values before running fremor run or fremor yaml.

  2. MIP table retrieval – fetches the official MIP tables from trusted GitHub repositories. By default tables are fetched via git clone (shallow, depth 1); with --fast they are fetched as a tarball via curl and extracted in-place.

Trusted sources

Functions

  • cmor_init_subtool(...)

fremor.cmor_init.cmor_init_subtool(mip_era, exp_config=None, tables_dir=None, tag=None, fast=False)

Initialise CMOR resources for the user.

Depending on the arguments supplied this function will:

  • Write an empty experiment-configuration JSON file for the requested MIP era (cmip6 or cmip7) when exp_config is given (or when neither exp_config nor tables_dir is provided — in which case a default filename is used).

  • Clone / download the official MIP tables into tables_dir when that argument is provided.

Parameters

mip_erastr

'cmip6' or 'cmip7'.

exp_configstr or None

Output path for the template experiment-config JSON file. When None and tables_dir is also None, a default path CMOR_<MIP_ERA>_template.json in the current directory is used.

tables_dirstr or None

Directory into which MIP tables will be fetched.

tagstr or None

Optional git tag / release for the MIP tables repository.

fastbool

When True, use curl to download a tarball instead of git clone.

Returns

dict

A dictionary with keys 'exp_config' (path written or None) and 'tables_dir' (path written or None).