UrbanHeatPro

Subpackages

Submodules

Package Contents

Functions

access_config_or_default(→ Any)

Get the value for a given configuration parameter and use the default configuration value if the configuration

nested_get(→ Any)

Get value from nested dictionary given a list of nested keys and return default for missing keys.

run_uhp

Run the UrbanHeatPro model.

UrbanHeatPro.access_config_or_default(config: dict, default_config: dict, nested_key) Any[source]

Get the value for a given configuration parameter and use the default configuration value if the configuration parameter is not in the configuration there.

Parameters:
  • config (dict) – Nested dictionary.

  • default_config (dict) –

  • nested_key – List of keys to access from outer dictionary to inner.

Returns:

Configuration value for the given list of keys. If a key is not available, raises a KeyError.

Return type:

Any

UrbanHeatPro.nested_get(input_dict: dict, nested_key: list, not_there='NotThere') Any[source]

Get value from nested dictionary given a list of nested keys and return default for missing keys.

Parameters:
  • input_dict (dict) – Nested dictionary.

  • nested_key (list) – List of keys to access from outer dictionary to inner.

  • not_there – Default value to be returned in case key does not exist

Returns:

Value for the given list of keys. If a key is not available, then returns the default value.

Return type:

Any

UrbanHeatPro.run_uhp(selected_region: str = None, simulation_name: str = None, buildings_use_filter='', settings_file='../settings/uhp_settings_example.yaml', result_dir=None)

Read the configuration file and run the UrbanHeatPro model.

Use this function to run the UrbanHeatPro model from another python package,module or script. This function expects the default configuration file at ../settings/uhp_default_settings.yaml. The configuration file can be changed using the settings_file parameter. To make changes to the configuration of the model, change the values in the configuration file with the path specified in settings_file.

Parameters:
  • selected_region (str) – Name or identifier of the region to be simulated, defaults to None

  • simulation_name (str) – Name of the simulation, defaults to None. If None, the name of the region is used.

  • buildings_use_filter – Optional usetype identifier for the buildings file, defaults to ‘’

  • settings_file – Path to the settings file, defaults to '../settings/uhp_settings_example.yaml'

  • result_dir – Path to the result directory, defaults to None. If None, the ../results/ directory is used.