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: object

Top-level configuration container.

Composed of four sections that mirror the YAML structure:

Use from_yaml() or load_config() to construct an instance from disk.

See also

load_config

Recommended 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.

get_used_parameters()

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.

paths

simulation_defaults

execution

output

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:

SimulationConfig

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 Path objects are converted to strings so the result is immediately YAML-serialisable.

Returns:

Nested dictionary mirroring the YAML structure.

Return type:

dict

See also

to_yaml

Write 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")