The Particle Table#

A transport model run gives one table: a row per particle per output step. Everything after the run reads it: the stages, the plots, and the particle files in the output directory. sim.particles and runtraj.run_trajectories() return it as a pandas DataFrame. Output Layout says how a particle file stores it.

Every table has five columns, PARTICLE_SCHEMA:

Column

Units

Meaning

particle

none

Particle number, from 1 to numpar. A particle keeps its number for the whole run. HYSPLIT calls it indx. Stored as int32 and read back as float64.

age

minutes

Time since release. Negative for a backward run, positive for a forward one. HYSPLIT calls it time. Stored as whole minutes, int32, and read back as float64.

lon

degrees east

Longitude of the particle (HYSPLIT’s long).

lat

degrees north

Latitude of the particle (HYSPLIT’s lati).

zagl

m

Height of the particle above ground.

The release row#

A model should write each particle’s release as a row at age = 0. That row is where the particle started, so it says which release point of a multipoint release the particle left from, and which slab of a column release (add_release_heights()). A model that writes no such row says where each particle started through its release_rows (TransportModel); without either, a column or multipoint release fails with the reason NO_RELEASE_ROWS.

HYSPLIT 5.1.0 writes no release row: its first row is one time step after release. Its release_rows matches each particle to a release point from its first position, and takes a column’s particles to be released bottom to top in particle order. A HYSPLIT build that writes the release rows (directory) makes the matching exact.

Columns the model adds#

HYSPLIT writes the variables in varsiwant under HYSPLIT’s lowercase four-letter names, except indx, time, long, and lati, which become the columns above. The allowed names are listed under varsiwant in Configuration; the config refuses any other name when it is read. Some of them:

Column

Units

Meaning

foot

ppm per (µmol m⁻² s⁻¹)

The particle’s sensitivity to surface fluxes accumulated over the output step, which HYSPLIT computes with ICHEM=8 and its veght (Lin et al., 2003).

mlht

m

Mixed-layer height above ground.

dens

kg m⁻³

Air density.

samt

minutes

Time the particle spent in the surface layer during the step.

sigw

m s⁻¹

Standard deviation of the vertical wind.

tlgr

s

Lagrangian time scale.

pres

hPa

Pressure.

zsfc

m

Terrain height above sea level.

zcfx

m

Vertical displacement by convective flux along the trajectory, summed over the steps (the Grell scheme, capemin: -2). HYSPLIT reads this name only: zfx1 stops it, and the config refuses it.

Columns runtraj adds#

release_height

Release height of each particle, in meters in the release’s own vertical reference, for column and multipoint releases (add_release_heights()). For a column it is the center of the particle’s slab, the part of the column the particle stands for.

time

The time of each row, in UTC: the release time plus age. It is not stored; reading a particle file adds it, and so does runtraj.run_trajectories().

weight

How much each row counts, written by the particle transforms (Transforms and Sampling), which multiply it; 1 where none has run. It is not stored: a stage applies its transforms when it reads the particles, and multiplies what it makes from a row by the row’s weight. Pressure weighting and an averaging kernel also add pwf, xpres and ak_weight.

Checking a table#

PARTICLE_SCHEMA

The columns every particle table has, as a particle file stores them: what a transport model's run must return.

check_particles

Check that a particle table has the columns of PARTICLE_SCHEMA, and need.

A result file’s release#

A stage that writes a Parquet file of its own records the release in the file’s metadata with release_metadata(), and stored_release() reads it back from the file’s schema metadata. Neither names the metadata key, which is runtraj’s.

release_metadata

Return the Parquet schema metadata that records release in a result file.

stored_release

Return the release a stored result file records in its metadata.

After a run#

After a run runtraj adds the release heights to any model’s particles. That, with the columns the model wrote, is what a particle file stores and sim.particles returns: a model that writes no foot has none there.

add_release_heights

Return particles with each particle's release_height, for a column or multipoint release.

Met columns for a model that writes only positions#

A transport model that writes only positions leaves out the columns HYSPLIT writes from the met. sample_met() reads mlht, dens, pres and zsfc from the met files at each particle’s position and time, as HYSPLIT reads them. Give it the files the run read and the top of its domain, which a stored run records:

import runtraj
from runtraj.sampling import sample_met

meta = runtraj.particles.particles_metadata(sim.particles_path)
sampled = sample_met(
    sim.particles.drop(columns=["mlht", "dens"]),
    meta.met_files,
    columns=["mlht", "dens"],
    z_top=meta.settings["z_top"],
)

The sampled values differ a little from HYSPLIT’s own columns, by the amounts under sample_met()’s Notes. mlht from sample_met() is the met’s PBLH. A transport model may find the mixed layer from the met’s profile instead: HYSPLIT does by default (kmixd: 3), and FLEXPART does on ERA5. calc_pbl_height() finds the mixed layer the way the run did; give it the run’s method:

from runtraj.sampling import calc_pbl_height

mlht = calc_pbl_height(sim.particles, meta.met_files)  # HYSPLIT, kmixd: 3
mlht = calc_pbl_height(sim.particles, meta.met_files, method="hysplit_temperature")  # kmixd: 1
mlht = calc_pbl_height(particles, met, method="flexpart")  # FLEXPART on ERA5

Met files that are not ARL files, such as GRIB, are read as one Dataset in arlmet.open_dataset()’s layout, the way a converter in arlmet.converters writes it. Both functions take that Dataset in place of the files, and sample it as they would sample the ARL file arlmet.write_dataset() would write from it. A transport model that reads such files opens them for you: runtraj.models.open_met() returns the Dataset, cropped to where the particles are, or the paths of ARL files as they are.

sample_met

Return the particles with met columns sampled at each particle's position.

calc_pbl_height

Return the mixed-layer height at each particle, found from the met as a transport model finds it.