pyradtran.config.SimulationConfig#
- class pyradtran.config.SimulationConfig(paths: ~pyradtran.config.PathsConfig, simulation_defaults: ~pyradtran.config.SimulationDefaults, execution: ~pyradtran.config.ExecutionConfig = <factory>, output: ~pyradtran.config.OutputConfig = <factory>)[source]#
Bases:
objectTop-level configuration container.
Composed of four sections that mirror the YAML structure:
PathsConfig— file-system paths.SimulationDefaults— physics & spectral settings.ExecutionConfig— parallelism & debugging.OutputConfig— NetCDF output.
Use
from_yaml()orload_config()to construct an instance from disk.See also
load_configRecommended entry point (merges three layers).
- __init__(paths: ~pyradtran.config.PathsConfig, simulation_defaults: ~pyradtran.config.SimulationDefaults, execution: ~pyradtran.config.ExecutionConfig = <factory>, output: ~pyradtran.config.OutputConfig = <factory>) None#
__init__(paths, simulation_defaults[, ...])from_yaml(yaml_path)Load configuration from a single YAML file.
Return a flat dictionary of all active parameters.
to_dict()Serialise the full configuration to a plain nested dict.
to_yaml(path)Write the configuration to a YAML file.
- execution: ExecutionConfig#
- classmethod from_yaml(yaml_path: str | Path) SimulationConfig[source]#
Load configuration from a single YAML file.
- Parameters:
yaml_path (str or pathlib.Path) – Path to the YAML file.
- Return type:
- Raises:
FileNotFoundError – If yaml_path does not exist.
- get_used_parameters() Dict[str, Any][source]#
Return a flat dictionary of all active parameters.
Useful for logging or embedding in NetCDF attributes.
- Return type:
dict
- output: OutputConfig#
- paths: PathsConfig#
- simulation_defaults: SimulationDefaults#
- to_dict() Dict[str, Any][source]#
Serialise the full configuration to a plain nested dict.
All
Pathobjects are converted to strings so the result is immediately YAML-serialisable.- Returns:
Nested dictionary mirroring the YAML structure.
- Return type:
dict
See also
to_yamlWrite the result directly to a file.
- to_yaml(path: str | Path) Path[source]#
Write the configuration to a YAML file.
- Parameters:
path (str or pathlib.Path) – Destination file. Parent directories are created automatically.
- Returns:
The resolved path to the written file.
- Return type:
pathlib.Path
Examples
Build a config dict in Python, load it, then persist it:
>>> cfg = load_config() >>> cfg.to_yaml("config/my_simulation.yaml")