:py:mod:`opendrift.config` ========================== .. py:module:: opendrift.config Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: opendrift.config.Configurable Attributes ~~~~~~~~~~ .. autoapisummary:: opendrift.config.logger opendrift.config.CONFIG_LEVEL_ESSENTIAL opendrift.config.CONFIG_LEVEL_BASIC opendrift.config.CONFIG_LEVEL_ADVANCED .. py:data:: logger .. py:data:: CONFIG_LEVEL_ESSENTIAL :value: 1 .. py:data:: CONFIG_LEVEL_BASIC :value: 2 .. py:data:: CONFIG_LEVEL_ADVANCED :value: 3 .. py:class:: Configurable .. py:attribute:: _config :type: Union[Dict, None] .. py:method:: get_config(key, default='raise') .. py:method:: list_config(prefix='') List all possible configuration settings with values .. py:method:: list_configspec(prefix='') Readable formatting of config specification .. py:method:: get_configspec(prefix='', level=[1, 2, 3]) .. py:method:: set_config(key, value) .. py:method:: _set_config_default(key, value) Update both default and actual value of a config setting .. py:method:: _add_config(config, overwrite=True) 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