openairclim.read_config

Reads a config file, assigns values to variables and creates an output directory

openairclim.read_config.check_against_template(config, config_template, default_config)[source]

Checks config dictionary against template: - check if config is complete, - add default settings if required, - check if values have correct data types.

Parameters:
  • config (dict) – Configuration dictionary

  • config_template (dict) – Configuration template dictionary

  • default_config (dict) – Default configuration dictionary

Returns:

Configuration dictionary, possibly with added default settings

Return type:

dict

openairclim.read_config.check_config(config, config_template, default_config)[source]

Checks if configuration is complete and correct

Parameters:

config (dict) – Configuration dictionary

Raises:

KeyError – if no response file defined

Returns:

Configuration dictionary

Return type:

dict

openairclim.read_config.classify_response_types(config, species_arr)[source]

Classifies species into categories based on their response types defined in the config

Parameters:
  • config (dict) – Configuration dictionary

  • species_arr (list) – A list of strings representing the species

Returns:

A tuple of lists. list (species_rf) contains species with response type ‘rf’,

i.e. a response file must be given comprising the response surface from emissions to RF, list (species_tau) contains species with response type ‘tau’, i.e. a response file must be given comprising the response surface from emissions to inverse species lifetime.

Return type:

tuple

Raises:

KeyError – If no valid response type is defined in the configuration for a species.

openairclim.read_config.classify_species(config)[source]

Classifies species into applied response modelling methods

Parameters:

config (dict) – Configuration dictionary

Raises:
  • KeyError – if no valid response_grid in config

  • KeyError – if no response defined for a spec

Returns:

tuple of lists of strings (species names)

Return type:

tuple

openairclim.read_config.create_output_dir(config)[source]

Check for existing output directory, results file, overwrite and run_oac settings. Create new output directory if needed.

Parameters:

config (dict) – Configuration dictionary

Raises:

OSError – if no output directory is created or results file not existing with run_oac = false

openairclim.read_config.get_config(file_name)[source]

load_config, check_config and create_output_dir

Parameters:

file_name (str) – Name of config file

Returns:

Configuration dictionary

Return type:

dict

openairclim.read_config.load_ac_data(config)[source]

Load aircraft identifier parameters from a separate csv file.

Parameters:

config (dict) – Configuration dictionary

Raises:
Returns:

Configuration dictionary modified in-place

Return type:

dict

openairclim.read_config.load_config(file_name)[source]

Loads config file in toml format.

Parameters:

file_name (str) – Name of config file

Returns:

Configuration dictionary

Return type:

dict