isofit.configs

Submodules

Classes

BaseConfigSection

Base Configuration Section from which all Configuration Sections inherit. Handles shared functionality like getting,

Config

Handles the reading and formatting of configuration files. Please note - there are many ways to do this, some

Package Contents

class BaseConfigSection[source]

Bases: object

Base Configuration Section from which all Configuration Sections inherit. Handles shared functionality like getting, setting, and cleaning configuration options.

set_config_options(configdict: dict = None) None[source]

Read dictionary and assign to attributes, leaning on _set_callable_attributes :param configdict: dictionary-style config for parsing

check_config_validity() List[str][source]
get_config_options_as_dict() Dict[str, Dict[str, any]][source]
get_config_as_dict()[source]
_check_config_validity() List[str][source]
_get_expected_type_for_option_key(option_key: str) type[source]
_get_nontype_attributes() List[str][source]
_get_type_attributes() List[str][source]
_get_hidden_attributes() List[str][source]
get_all_elements()[source]
get_all_element_names()[source]
get_elements()[source]
get_element_names()[source]
get_single_element_by_name(name)[source]
class Config(configdict)[source]

Bases: 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
_input_type
input

Input config. Holds all input file information.

Type:

InputConfig

_output_type
output

Output config. Holds all output file information.

Type:

OutputConfig

_forward_model_type
forward_model

forward_model config. Holds information about surface models, radiative transfer models, and the instrument.

Type:

ForwardModelConfig

_implementation_type
implementation

holds information regarding how isofit is to be run, including relevant sub-configs (e.g. inversion information).

Type:

ImplementationConfig

get_config_errors()[source]

Get configuration option errors by checking the validity of each config section.

check_inter_section_validity()[source]