isofit.configs.configs
- class Config(configdict)[source]
Bases:
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
Input config. Holds all input file information.
- Type:
- output
Output config. Holds all output file information.
- Type:
- forward_model
forward_model config. Holds information about surface models, radiative transfer models, and the instrument.
- Type:
- implementation
holds information regarding how isofit is to be run, including relevant sub-configs (e.g. inversion information).
- Type:
- get_config_as_dict()[source]
Get configuration options as a nested dictionary with delineated sections.
- Return type:
- Returns:
Configuration options as a nested dictionary with delineated sections.