Core Objects#

The project, its releases, the simulations it runs, and their particles.

One release, without a project#

run_trajectories() runs the transport model for one release and returns what it made: its particles, or the result of another mode (HYSPLIT’s trajectory table or concentration grids). A project runs the same step for each of its releases and stores the results.

particles = runtraj.run_trajectories(release, met, n_hours=-24, numpar=200)

run_trajectories

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

Project interface#

Project is what you open a project with. It runs the transport model, and each stage the project lists, and reads the results.

Project

A project's particle runs: releases, settings, and the simulations they define.

Release objects#

Release

Base class of the release types.

PointRelease

Release that releases particles from one point.

ColumnRelease

Release that releases particles evenly along a vertical line.

MultiPointRelease

Release that releases particles from several points at once.

read_releases

Read releases from a CSV file.

releases.write_releases

Write releases to a CSV file that read_releases() reads, and return its path.

releases.releases_to_frame

Return releases as one table with a row per release point.

releases.releases_from_frame

Check a table with a row per release point and build its releases.

releases.parse_release_id

Split a release id into its release time and location id.

Simulation objects#

A Variant is one variant of a project, resolved: its configs, its met, the transport model build, and the hashes that find its results. project.variants holds them, and ProjectConfig.resolve() makes them from a config. Simulation is one release under one variant, which project.simulation(release_id, variant) returns.

Simulation

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

config.Variant

One variant, resolved: its configs, its met, its transport model, and its hashes.

Settings and their hashes#

runtraj.identity records what a run was made with, as its folder’s _settings.yaml holds it, and hashes it. A stage records its own settings (runtraj.stages.Stage.settings()), which are hashed with the particles’ hash and the hash of each stage it reads. A stored record is read back through the current config classes, so a setting added since, with a default, still matches.

identity.run_settings

Return the settings that identify a run, in canonical form.

identity.read_run_settings

Return the run settings a _settings.yaml records, read through the current classes.

identity.transport_from_settings

Return the transport model's config a run settings record holds.

identity.stage_hash

Return the hash of the results of the stage name with settings.

identity.settings_hash

Return the SHA-256 hex digest of settings.

identity.file_stamp

Return what a result file records besides its contents, as Parquet file metadata.

models.ModelInfo

The transport model build a run was made with.

Particles#

A simulation’s particles are a pandas DataFrame. runtraj’s methods on them are under .runtraj (ParticlesAccessor). The functions below read and write particle files without a project.

read_particles

Read a particle file.

particles.particles_metadata

Return the release, run settings, and met files a particle file records.

particles.write_particles

Write a particle table to a Parquet file that read_particles() reads alone.

particles.ParticlesAccessor

runtraj's methods on a particle table, as particles.runtraj.

Simulation tables#

project.releases is a pandas DataFrame with one row per release, and project.simulations one with one row per simulation. Select rows as in pandas, then pass the selection to the project’s status(), incomplete(), or particles().

sims = project.simulations
wbb = sims[(sims.variant == "hrrr") & (sims.site == "WBB")]
particles = project.particles(wbb)

Boxes#

A Bounds is documented under Configuration. runtraj.spatial has the CRS helpers.

spatial.same_crs

Return whether two CRS strings describe the same CRS, however they are spelled.

spatial.is_longlat

Return whether crs is geographic (longitude/latitude degrees).

spatial.horizontal_dims

Return the names of the horizontal dimensions, (y_dim, x_dim).