stilt.ProjectConfig#

class stilt.ProjectConfig(*, model: str = 'hysplit', mets: dict[str, dict[str, typing.Any]]=<factory>, variants: dict[str, dict[str, typing.Any]]=<factory>, execution: stilt.execution.config.ExecutionConfig = <factory>, output: str = 'output', **extra_data: Any) → None[source]#

A project’s configuration, as read from config.yaml.

The transport model’s parameters and the footprint fields are flat, top-level keys, and are the defaults for every variant. model names the transport model, HYSPLIT unless set; its parameters are checked by its own config class and are in transport. The footprint fields are in footprint. Each variant names a met and overrides some of the defaults; only the declared variants run. A variant that names another model gives that model’s own parameters itself, and inherits the parameters every model shares (TransportConfig). An unknown key is an error that names the nearest setting.

Parameters#

Parameter

Description

Default

model

Transport model the variants run with, unless a variant names another: hysplit, stilt-r (runs imported from STILT-R, which cannot run), or the import path of a model class in another package, such as mypkg.models.MyModel. Its parameters are top-level keys of the config.

'hysplit'

mets

Meteorology by name, such as hrrr. At least one is required. Each is checked by the met config of the transport model that reads it (stilt.transport.hysplit.MetConfig for HYSPLIT).

{}

variants

Variants by name, each a set of overrides of the defaults. A variant may also set met (needed with several mets unless the variant has a met’s name) and realizations (run N times, realization k with seed + k, as one ensemble). Variants with the same transport settings share one transport model run and differ in the footprint made from it. At least one is required: hrrr: {} runs the defaults.

{}

execution

Where the receptors run and with what resources, such as backend: slurm and its options.

ExecutionConfig(backend='local', n_workers=1, cpus=1, time=None, mem=None, partition=...

output

Directory the results go to, relative to the project directory unless absolute. A URL such as s3://bucket/output puts it on an object store. Several projects can name the same directory and share runs.

'output'

Attributes#

footprint

The footprint settings from the top-level keys, which every variant starts from.

transport

The transport model's config from the top-level keys, which every variant starts from.

Methods#

declared()

Return the variants as written.

from_yaml(path)

Load a project config from a YAML file.

met_config(name[, model])

Return the met called name, checked by the met config of the transport model model.

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

resolve([directory])

Return one Variant per declared variant, in declared order.

to_yaml([path])

Return the config as YAML, and write it to path when given.