zen_garden.postprocess.comparisons

File that contains functions to compare the results of two or more models.

Functions

check_and_fill_scenario_list(results, scenarios)

Checks if both results have the provided scenarios.

compare_component_values(results, ...[, ...])

Compares component values of two results.

compare_configs(results[, scenarios])

Compares the configs of two results, namely the Analysis-Config and the System-config.

compare_dicts(dict1, dict2[, result_names])

Compares two dictionaries and returns only the fields with different values.

compare_model_values(results, component_type)

Compares the input data of two or more results.

get_common_scenario(results_1, results_2)

Returns the name of a common scenario that are in both provided results.

get_component_diff(results, component_type, ...)

Returns a list with the differences in component names.

zen_garden.postprocess.comparisons.check_and_fill_scenario_list(results: list[Results], scenarios: list[str]) list[str]

Checks if both results have the provided scenarios.

Returns a list containing twice one common scenario.

Parameters:
  • results – List of results.

  • scenarios – List of names of scenario.

Returns:

List of scenario names

zen_garden.postprocess.comparisons.compare_component_values(results: list[Results], component_name: str, compare_total: bool, scenarios: list[str] = None, rtol: float = 0.001) DataFrame

Compares component values of two results.

Parameters:
  • results – list with results

  • component_name – component name

  • compare_total – if True, compare total value, not full time series

  • scenarios – None, str or tuple of scenarios

  • rtol – relative tolerance of equal values

Returns:

dictionary with diverging component values

zen_garden.postprocess.comparisons.compare_configs(results: list[Results], scenarios: list[str] = None) dict[str, Any]

Compares the configs of two results, namely the Analysis-Config and the System-config.

Parameters:
  • results – List of results

  • scenarios – List of scenarios to filter by

Returns:

dictionary with diverging configs

zen_garden.postprocess.comparisons.compare_dicts(dict1: dict[Any, Any], dict2: dict[Any, Any], result_names: list[str] = None) dict[Any, Any] | None

Compares two dictionaries and returns only the fields with different values.

Parameters:
  • dict1 – first config dict

  • dict2 – second config dict

  • result_names – names of results

Returns:

diff dict

zen_garden.postprocess.comparisons.compare_model_values(results: list[Results], component_type: ComponentType | str, compare_total: bool = True, scenarios: list[str] = None) dict[str, DataFrame]

Compares the input data of two or more results.

Parameters:
  • results – list of results

  • component_type – component type to compare

  • compare_total – if True, compare total value, not full time series

  • scenarios – None, str or tuple of scenarios

Returns:

a dictionary with diverging results

zen_garden.postprocess.comparisons.get_common_scenario(results_1: Results, results_2: Results) str

Returns the name of a common scenario that are in both provided results.

Parameters:
  • results_1 – Results 1

  • results_2 – Results 2

Returns:

Name of common scenario

zen_garden.postprocess.comparisons.get_component_diff(results: list[Results], component_type: ComponentType, scenarios: list[str]) list[str]

Returns a list with the differences in component names.

Parameters:
  • results – list with results

  • component_type – component type to compare

Returns:

list with the common params