runtraj.run_trajectories#

runtraj.run_trajectories(release, met, *, model='hysplit', workdir=None, timeout=None, **params)[source]#

Run the transport model for one release and return what it made, particles unless the settings say another type.

This is what a project runs for each release, without a project: the result is returned, not stored. Its type follows the settings, as a variant’s does (runtraj.results): particles, or with HYSPLIT’s mode="trajectory" the trajectory table, or with mode="concentration" the grids.

Parameters:
  • release (runtraj.releases.Release) – Where and when particles are released.

  • met (BaseModel | Mapping[str, Any]) – The meteorology, as one entry under mets: in config.yaml, checked by the model’s met config (runtraj.models.hysplit.MetConfig for HYSPLIT). A string is the folder of its files, and a relative folder starts from the working directory.

  • model (str) – The transport model.

  • workdir (str | Path | None) – Directory the model runs in, kept afterwards for a look at its files. It must be empty or not exist yet. Without it the model runs in a temporary directory that is removed.

  • timeout (int | None) – Time limit in seconds. None waits indefinitely.

  • **params (Any) – The transport model’s parameters, such as n_hours and HYSPLIT’s numpar (runtraj.models.hysplit.HysplitConfig). n_hours is required; the others default to the model’s own values.

Returns:

The particle table, one row per particle per output step, with time (UTC), the release time plus age, as a table read from a particle file has. foot is the model’s own (HYSPLIT’s, made with veght). A model that writes no foot returns none. With settings that make another type, that type’s result: the trajectory table (runtraj.trajectories), or a tree of concentration grids (runtraj.concentration).

Return type:

Any

Raises:
  • ValueError – If workdir is not empty, or a parameter is not one of the model’s.

  • SimulationError – If the run fails; reason says why.

  • MeteorologyError – If the met files the run needs are missing.

Examples

>>> release = runtraj.PointRelease(
...     time="2023-07-15 18:00", longitude=-111.848, latitude=40.766, altitude=10
... )
>>> particles = runtraj.run_trajectories(
...     release,
...     "/data/hrrr",
...     model="hysplit",
...     n_hours=-24,
...     numpar=200,  # HYSPLIT's particle count
... )
>>> table = runtraj.run_trajectories(
...     release, "/data/hrrr", n_hours=-24, mode="trajectory"
... )