openairclim.core.config_model
Pydantic schema for the TOML configuration file.
Single source of truth for required/optional keys, defaults, and valid option strings (e.g. RF methods, attribution methods).
This file provides structural validation only. Checks that depend on input
files, aircraft parameters etc. are in read_config.py.
Config, AircraftEntry and AircraftCsvRow are the only public classes.
Config’s sections are implemented similarly to the TOML tree. Callers outside
of this module should resolve the values by walking Config.model_fields
(dotted TOML path) rather than importing them directly, so that they track the
config’s actual shape instead of this file’s internal class names. The
AircraftEntry and AircraftCsvRow classes are dynamically keyed and hence
cannot be reached via model_fields.
- openairclim.core.config_model.ALIAS_MAP = {'output.full_run': 'output.run_oac'}
Maps deprecated config keys to their replacement, applied before validation so renamed keys keep working in old config files.
- class openairclim.core.config_model.AircraftCsvRow(*, b: Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=20.0), Le(le=80.0)])] | None = None, PMrel: float | None = None, FSC: Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=0.0)])] | None = None, G_250: float | None = None, SAC_eq: Literal['CON', 'HYB', 'H2C', 'H2FC'] | None = None, Q_h: float | None = None, eta: float | None = None, eta_elec: float | None = None, EIH2O: float | None = None, R: float | None = None, PM: float | None = None, ac: str)[source]
Bases:
AircraftEntryOne row of the aircraft csv file.
AircraftEntry’s fields plus the aircraft identifier column, and pandas’ NaN/blank-string “missing” convention mapped toNonebeforeAircraftEntry’s own field validation/derivation runs (which expectsNone).- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class openairclim.core.config_model.AircraftEntry(*, b: Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=20.0), Le(le=80.0)])] | None = None, PMrel: float | None = None, FSC: Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=0.0)])] | None = None, G_250: float | None = None, SAC_eq: Literal['CON', 'HYB', 'H2C', 'H2FC'] | None = None, Q_h: float | None = None, eta: float | None = None, eta_elec: float | None = None, EIH2O: float | None = None, R: float | None = None, PM: float | None = None)[source]
Bases:
BaseModelDefine aircraft-specific parameters.
The parameters can either be defined in-line in the config (
config["aircraft"][<ac_id>]) or in a row of a linked csv file.Aircraft identifiers are required if the emission inventories have an
acdata variable. In addition, the parametersb(wingspan [m]),PMrel(nvPM emissions relative to 1.5e15 kg⁻¹) andG_250(slope of the Schmidt-Appleman mixing line at 250 hPa [Pa/K]) are required if contrails are being calculated (i.e."cont" in config["species"]["out"]). These parameters can also be calculated using sub-values, defined inAIRCRAFT_DERIVATION_MAP.Field declaration order matches the aircraft csv column order, but is not important.
- b: Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=20.0), Le(le=80.0)])] | None
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class openairclim.core.config_model.Config(*, species: _SpeciesConfig, inventories: _InventoriesConfig, output: _OutputConfig, time: _TimeConfig, background: _BackgroundConfig, responses: _ResponsesConfig, temperature: _TemperatureConfig = <factory>, metrics: _MetricsConfig = <factory>, aircraft: _AircraftConfig, parametric: _ParametricConfig = <factory>)[source]
Bases:
BaseModelProvides a pydantic data skeleton for a valid OpenAirClim configuration.
Set up to match the TOML file structure.
- Raises:
ValueError – If there are errors with the climate metrics definitions
- aircraft: _AircraftConfig
- background: _BackgroundConfig
- inventories: _InventoriesConfig
- metrics: _MetricsConfig
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- output: _OutputConfig
- parametric: _ParametricConfig
- responses: _ResponsesConfig
- species: _SpeciesConfig
- temperature: _TemperatureConfig
- time: _TimeConfig