esm_environment package

Top-level package for ESM Environment.

Submodules

esm_environment.esm_environment module

Main module for EsmEnvironment.

class esm_environment.esm_environment.EnvironmentInfos(run_or_compile, complete_config=None, model=None)[source]

Bases: object

static add_commands(commands, name)[source]

Writes all commands in a list to a file named <name>_script.sh, located in the current working directory. The header from this script is read from dummy_script.sh, also in the current working directory.

Parameters
  • commands (list of str) – List of the commands to write to the file after the header

  • name (str) – Name of the script, generally something like comp_echam-6.3.05

Returns

name + “_script.sh”

Return type

str

add_esm_var()[source]

Adds the ENVIRONMENT_SET_BY_ESMTOOLS=TRUE to the config, for later dumping to the shell script.

apply_config_changes(run_or_compile, config, model)[source]
apply_model_changes(model, run_or_compile='runtime', modelconfig=None)[source]
static cleanup_dummy_script()[source]

Removes the dummy_script.sh if it exists.

get_shell_commands()[source]

Gathers module actions and export variables from the config to a list, prepending appropriate shell command words (e.g. module and export)

Returns

Return type

list

output()[source]
replace_model_dir(model_dir)[source]

Replaces any instances of ${model_dir} in the config section “export_vars” with the argument

Parameters

model_dir (str) – The replacement string for ${model_dir}

write_dummy_script(include_set_e=True)[source]

Writes a dummy script containing only the header information, module commands, and export variables. The actual compile/configure commands are added later.

Parameters

include_set_e (bool) – Default to True, whether or not to include a set -e at the beginning of the script. This causes the shell to stop as soon as an error is encountered.

class esm_environment.esm_environment.environment_infos(*args, **kwargs)[source]

Bases: esm_environment.esm_environment.EnvironmentInfos