isofit.configs ============== .. py:module:: isofit.configs Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/isofit/configs/base_config/index /autoapi/isofit/configs/configs/index /autoapi/isofit/configs/sections/index Classes ------- .. autoapisummary:: isofit.configs.BaseConfigSection isofit.configs.Config Package Contents ---------------- .. py:class:: BaseConfigSection Bases: :py:obj:`object` Base Configuration Section from which all Configuration Sections inherit. Handles shared functionality like getting, setting, and cleaning configuration options. .. py:method:: set_config_options(configdict: dict = None) -> None Read dictionary and assign to attributes, leaning on _set_callable_attributes :param configdict: dictionary-style config for parsing .. py:method:: check_config_validity() -> List[str] .. py:method:: get_config_options_as_dict() -> Dict[str, Dict[str, any]] .. py:method:: get_config_as_dict() .. py:method:: _check_config_validity() -> List[str] .. py:method:: _get_expected_type_for_option_key(option_key: str) -> type .. py:method:: _get_nontype_attributes() -> List[str] .. py:method:: _get_type_attributes() -> List[str] .. py:method:: _get_hidden_attributes() -> List[str] .. py:method:: get_all_elements() .. py:method:: get_all_element_names() .. py:method:: get_elements() .. py:method:: get_element_names() .. py:method:: get_single_element_by_name(name) .. py:class:: Config(configdict) Bases: :py:obj:`isofit.configs.base_config.BaseConfigSection` Handles the reading and formatting of configuration files. Please note - there are many ways to do this, some of which require fewer lines of code. This method was chosen to facilitate more clarity when using / adding / modifying code, particularly given the highly flexible nature of Isofit. How to use: To add an additional parameter to an existing class, simply go to the relevant config (e.g. for forward_model go to sections/forward_model_config.py), and in the config class (e.g. ForwardModelConfig) add the parameter. Also Add a hidden parameter with the _type suffix, which will be used to check that configs read the appropriate type. Add comments directly below, to be auto-appended to online documentation. Example:: class GenericConfigSection(BaseConfigSection): _attribute_type = str attribute = 'my attribute' """str: attribute does whatever it happens to do""" To validate that attributes have appropriate relationships or characteristics, use the hidden _check_config_validity method to add more detailed validation checks. Simply return a list of string descriptions of errors from the method as demonstrated:: def _check_config_validity(self) -> List[str]: errors = list() if self.attribute_min >= self.attribute_max: errors.append('attribute_min must be less than attribute_max.') return errors .. py:attribute:: _input_type .. py:attribute:: input Input config. Holds all input file information. :type: InputConfig .. py:attribute:: _output_type .. py:attribute:: output Output config. Holds all output file information. :type: OutputConfig .. py:attribute:: _forward_model_type .. py:attribute:: forward_model forward_model config. Holds information about surface models, radiative transfer models, and the instrument. :type: ForwardModelConfig .. py:attribute:: _implementation_type .. py:attribute:: implementation holds information regarding how isofit is to be run, including relevant sub-configs (e.g. inversion information). :type: ImplementationConfig .. py:method:: get_config_errors() Get configuration option errors by checking the validity of each config section. .. py:method:: check_inter_section_validity()