opendrift.config

Module Contents

Classes

Configurable

Attributes

logger

CONFIG_LEVEL_ESSENTIAL

CONFIG_LEVEL_BASIC

CONFIG_LEVEL_ADVANCED

opendrift.config.logger
opendrift.config.CONFIG_LEVEL_ESSENTIAL = 1
opendrift.config.CONFIG_LEVEL_BASIC = 2
opendrift.config.CONFIG_LEVEL_ADVANCED = 3
class opendrift.config.Configurable[source]
_config: Dict | None
get_config(key, default='raise')[source]
list_config(prefix='')[source]

List all possible configuration settings with values

list_configspec(prefix='')[source]

Readable formatting of config specification

get_configspec(prefix='', level=[1, 2, 3])[source]
set_config(key, value)[source]
_set_config_default(key, value)[source]

Update both default and actual value of a config setting

_add_config(config, overwrite=True)[source]

Add configuration settings

config is a dictionary where keys are configuration keywords, and values are dictionaries with the following contents:

type (string): ‘float’, ‘int’, ‘bool’ or ‘enum’

min, max (float/int/None): (only when type is ‘float’ or ‘int’)

The minimum and maximum allowed values for this setting. May also be None if there are no upper/lowe limits.

units (string): (only when type is ‘float’ or ‘int’)

The units of this config setting.

enum (list): (only when type is ‘enum’)

A list of possible values for this setting.

default (number/bool/string/None):

The default value for this setting.

value (number/bool/string/None): The actual value for this setting.

This is updated with self.set_config(key, value) and retrieved with self.get_config(key)

description (string):

A description of this config setting, for users/documentation/GUIs.

level (int): A parameter to determine the level of exposure in GUIs

1 CONFIG_LEVEL_ESSENTIAL: important setting which user has to consider 2 CONFIG_LEVEL_BASIC: setting which many users may consider 3 CONFIG_LEVEL_ADVANCED: setting relevant only to advanced users