stilt.Simulation#

class stilt.Simulation(receptor: 'Receptor', config: 'VariantConfig', *, met: 'MetStream | None' = None, parent: 'Simulation | None' = None, directory: 'str | Path | None' = None, store: 'Store | None' = None)[source]#

One receptor run under one variant.

A simulation runs HYSPLIT for its receptor and calculates a footprint from the particles. A derived simulation (a from: variant) runs no HYSPLIT and calculates its footprint from its parent’s particles. The simulation knows where its output files are and whether they all exist (is_complete()).

You rarely build one yourself. Get it from a model instead, as in model.simulations[receptor_id, "hrrr"].

Parameters

receptorReceptor

Where and when particles are released.

configVariantConfig

Settings of the variant. config.name is the variant name.

metMetStream, optional

Meteorology for the HYSPLIT run. Required unless parent is given.

parentSimulation, optional

Simulation whose particles this one uses. Such a simulation never runs HYSPLIT.

directorystr or Path, optional

Working directory where HYSPLIT runs and outputs are written. A temporary directory is used when omitted. Nothing is created until an output is written.

storeStore, optional

Project store. Outputs are copied there by publish() and read from there when they are not in directory.

Methods#

clear_empty_footprint_marker()

Remove the empty-footprint marker.

delete()

Delete this simulation's outputs from the store and its working directory.

generate_footprint([config, write, ...])

Calculate the footprint from the particles.

is_complete()

Return whether every expected output exists.

key(path)

Return the store key of one of this simulation's files.

publish()

Copy this simulation's outputs from the working directory to the store.

resolve(path)

Return a local path to an output file, from the working directory or the store, or None.

run_trajectories([timeout, rm_dat, write])

Run HYSPLIT and keep the particles as trajectories.

transform_context()

Return the TransformContext passed to this simulation's transforms.

write_empty_footprint_marker(reason)

Write the empty-footprint marker holding reason and return its path.

Attributes#

empty_footprint_path

Path of the marker written instead of the NetCDF when the footprint is empty.

empty_reason

Why the footprint is empty, or None when it is not.

footprint

The footprint, or None if it does not exist yet.

footprint_path

Path of the footprint NetCDF file in the working directory.

has_footprint

Whether the footprint file or the empty-footprint marker exists.

has_trajectory

Whether the trajectory file exists (the parent's for a derived simulation).

is_backward

Whether particles run backward in time (n_hours < 0).

is_derived

Whether this simulation uses another simulation's particles.

log

Text of the HYSPLIT log.

log_path

Path of the HYSPLIT log in the working directory.

makes_footprint

Whether this simulation makes a footprint, which it does when its variant has a grid.

met_dir

Directory where meteorology files are staged for HYSPLIT.

met_files

Meteorology files staged in met_dir for HYSPLIT.

outcome

How this simulation ended, read from its outputs and log.

outputs

Paths of the log, footprint, and empty-marker files, and the trajectory file unless derived.

plot

Plotting methods, such as sim.plot.map().

source_met_files

Meteorology files in the archive that cover this simulation's period.

time_range

Start and end of the period the particles cover.

trajectories

Particle trajectories, or None if they do not exist yet.

trajectories_path

Path of the trajectory Parquet file (the parent's for a derived simulation).

variant

Variant name.