stilt.Model#

class stilt.Model(project: 'str | Path | None' = None, receptors: 'Receptor | Iterable | str | Path | None' = None, config: 'ModelConfig | None' = None, compute_root: 'str | Path | None' = None, runtime: 'RuntimeSettings | None' = None, **kwargs)[source]#

A STILT project: receptors, settings, and the simulations they define.

A model runs every receptor once per variant and loads the resulting trajectories and footprints. Its inputs and outputs live in a project directory or object-store URI. Settings and receptors given here are saved to the project when the model runs, so Model(project) opens it again later.

Parameters

projectstr or Path, optional

Project directory or object-store URI. A temporary directory is used when omitted.

receptorsReceptor, iterable of Receptor, str or Path, optional

Receptors to run, or the path of a receptors CSV (relative to the project directory). Defaults to the project’s receptors.csv.

configModelConfig, optional

Model settings. Defaults to the project’s config.yaml.

compute_rootstr or Path, optional

Directory under which simulations run. Defaults to PYSTILT_COMPUTE_ROOT, then to the project’s simulations/by-id for a local project or a temporary directory for a cloud project.

runtimeRuntimeSettings, optional

Settings for this machine (download cache, work-queue URL, and compute root). Read from PYSTILT_* environment variables when omitted.

**kwargs

Settings for ModelConfig, such as n_hours, numpar, mets, and grid. Cannot be combined with config.

Methods#

check_config()

Check that no registered variant or met has changed its settings.

orphans()

Return the registered variants that config.yaml no longer declares.

register([receptors])

Save the model's settings and receptors to the project.

remove(variant)

Delete every simulation of a variant and forget its settings.

run([executor, skip_existing, wait])

Run every simulation that has not finished.

simulation(key)

Return one simulation by id.

status()

Return one row per simulation saying which outputs exist.

Attributes#

config

Model settings, from config.yaml unless given to the constructor.

mets

Meteorology sources declared in the config, by name.

plot

Plotting methods, such as model.plot.availability().

queue

Postgres work queue, or None when PYSTILT_DB_URL is not set.

receptors

Receptors, by position (receptors[0]) or by id (receptors[receptor_id]).

simulations

Every receptor under every variant, indexed by (receptor_id, variant).

variants

Settings of each variant, by name, in config order.