openairclim.gui.components.schema
Helpers for driving GUI widgets off core.config_model’s pydantic schema.
- openairclim.gui.components.schema.field_description(model: type[BaseModel], field: str) str | None[source]
Return a pydantic model field’s Field(description=…). This can be passed straight through to a panel widget’s own description kwarg to provide a tooltip.
- openairclim.gui.components.schema.is_string_like_field(model: type[BaseModel], field: str) bool[source]
Return True if field’s values should be treated as strings/objects (e.g. for a pandas dtype or a Tabulator “input”/”list” editor), rather than numeric — i.e. its annotation is (optionally) str or a Literal[…] of strings.
- openairclim.gui.components.schema.literal_choices(model: type[BaseModel], field: str) list[source]
Return the allowed values of a Literal[…] field — optionally wrapped in list[…] (e.g. species.out) and/or made optional (e.g. Literal[…] | None).
- openairclim.gui.components.schema.submodel(path: str) type[BaseModel][source]
Resolve a dotted config path to its pydantic submodel class. Walks through Config.model_fields (e.g. “responses.CO2.rf”) rather than importing the per-section classes directly, so that the data can be referenced in the actual toml shape.
- Parameters:
path (str) – Dotted field path, starting from Config.
- Returns:
The pydantic model class at that path.