isofit.configs
Submodules
Classes
Base Configuration Section from which all Configuration Sections inherit. Handles shared functionality like getting, |
|
Handles the reading and formatting of configuration files. Please note - there are many ways to do this, some |
Package Contents
- class BaseConfigSection[source]
Bases:
objectBase 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
- class Config(configdict)[source]
Bases:
isofit.configs.base_config.BaseConfigSectionHandles 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:
- _output_type
- output
Output config. Holds all output file information.
- Type:
- _forward_model_type
- forward_model
forward_model config. Holds information about surface models, radiative transfer models, and the instrument.
- Type:
- _implementation_type
- implementation
holds information regarding how isofit is to be run, including relevant sub-configs (e.g. inversion information).
- Type: