Result Types and Concentration#

A transport model makes one type of result per run, and every model that makes a type follows its one schema (runtraj.results):

Type

What it is

File per release

particles

The particle table (The Particle Table), from HYSPLIT’s particles mode or another model that follows particles.

Parquet, under particles/

concentration

Grids of concentration, from HYSPLIT’s mode: concentration (Concentration Grids).

NetCDF, under concentration/

trajectories

The trajectory table (Trajectories), from HYSPLIT’s mode: trajectory (Trajectories).

Parquet, under trajectories/

A model says which type a config makes with result(config) (TransportModel), and makes particles when it does not say. runtraj.config.Variant.result is the variant’s type, and the name of its tree in the output directory. project.status() has a column for each type a variant makes, and each type has its own read: Project.particles() and sim.particles, Project.concentration() and sim.concentration, Project.trajectories() and sim.trajectories. A stage reads particles, so a variant that makes another type has no stages.

results.RESULT_TYPES

The result types, by name.

results.ResultType

One type of result: its name, its file's suffix, and how a file of it is checked, written, and read.

results.result_type

Return the result type called name.

results.model_result

Return the type of result model makes with config: its result(config), or particles.

A concentration result#

One release’s result is an xarray.DataTree with a child per grid, named as the grid is in config.yaml. Each grid is a Dataset over CONCENTRATION_DIMS:

Name

Units

Meaning

time

UTC

When each sample starts. In a backward run each sample starts before the one above it.

time_end

UTC

When each sample ends, a coordinate along time. A snapshot starts and ends at once.

z

m

The top of each level above ground, in whole meters. 0 is the ground, where deposition is counted.

lat, lon

degrees

The centers of the grid’s cells.

one variable per pollutant

set by the model

What the model counts, which its units and long_name attributes say. HYSPLIT’s concentration: mass m⁻³ in the unit of mass of the pollutant’s emission rate, and at z = 0, mass m⁻² deposited. With cmass: 1: the mass in each cell, in the same unit of mass, and nothing at z = 0. Zero where the model wrote nothing.

source or release_time

a number, or UTC

Only when the model counts each pollutant apart by where or when it was released (SPLIT_DIMS), as HYSPLIT’s ichem: 1 and ichem: 10 do. It is then the first dimension of every variable, before the four above: source numbers the release’s points from 1, with source_lon, source_lat and source_height; release_time is when each part of the emission started.

The file of one release is NetCDF 4, a group per grid, which xarray.open_datatree() opens, as do ncdump and R’s ncdf4. Its root attributes say what made it: release (the release id), runtraj:settings and runtraj:met_files (JSON, as a particle file’s metadata), runtraj:hash and runtraj:version, and, in an ensemble, runtraj:realization. Writing and reading it needs netCDF4, which pip install 'runtraj[concentration]' installs.

CONCENTRATION_DIMS

The dimensions of every grid's variables, in order.

SPLIT_DIMS

The dimensions a grid's variables may have before CONCENTRATION_DIMS, when the model counts each pollutant apart by where or when it was released.

check_concentration

Raise unless result is a concentration result: a DataTree of grids.

describe_grid

Give a grid's coordinates and variables their units and meanings, in place, and return it.

read_concentration

Read a concentration file write_concentration() wrote.

write_concentration

Write a concentration result to a NetCDF file that read_concentration() reads alone.

require_netcdf4

Raise when netCDF4, which writes and reads the files, is not installed.