runtraj.Simulation#

class runtraj.Simulation(release: 'Release', variant: 'Variant', output: 'Output', directory: 'Path | None' = None, realization: 'int | None' = None) → None[source]#

One release run under one variant, as one realization of an ensemble or alone.

A simulation is a value: its release, its variant, and the output directory its results are in. From those it knows where the transport model’s result (its particles, or another type: result_path), the file of each stage (path()), and its log are, whether they exist (has(), is_complete), and how to read them. It runs nothing itself; the workers in runtraj.execution run the transport model and the stages.

You rarely build one yourself. Get it from a project instead, as in project.simulation(release_id, "hrrr").

Parameters

releaseRelease

Where and when particles are released.

variantVariant

The variant, resolved: its configs, and the hashes that find its particles folder and its stages’ folders.

outputOutput

The output directory.

directoryPath, optional

The project directory, where a relative file name in the settings starts. None starts it from the working directory.

realizationint, optional

Which realization of an ensemble variant (realizations: N), 0 to N - 1. None for a variant that runs once.

Attributes#

concentration

The concentration result, a child per grid (runtraj.concentration).

failure

Why this simulation is not complete, as the worker recorded it, or None.

has_particles

Whether the particle file exists.

has_result

Whether the transport model's result exists, whatever its type.

id

(release.id, variant.name, realization), the row of project.simulations it is.

is_complete

Whether every expected result exists.

kept_workdir

Where a failed run's working directory is kept, or None before its folder exists.

log

Text of the transport model's log.

log_path

Path of the transport model's log in the output directory, or None before its folder exists.

particles

The particle table, one row per particle per output step.

particles_path

Path of the particle file in the output directory, or None before its folder exists.

result

The transport model's result, of the type the variant makes.

result_path

Path of the transport model's result in the output directory, or None before its folder exists.

trajectories

The trajectory table, one row per trajectory per output time (runtraj.trajectories).

transport

The transport config this simulation runs with.

Methods#

has(kind)

Return whether this simulation's file of kind exists.

path(kind)

Return the path of this simulation's file of kind in the output directory.