runtraj.transforms.Oxidation#

class runtraj.transforms.Oxidation(*, kind: Literal['oxidation'] = 'oxidation', a: Annotated[float, Gt(gt=0)], e_over_r: float = 0.0, oxidant: float | str, variable: str | None = None, coordinate: str = 'pres') → None[source]#

Transform that weighs each row by the tracer that survives a reaction with an oxidant.

Use it for a species lost mainly to one reaction whose rate you know, such as CO, ethane, or methane with OH. The rate at each row is k(T) [X], with the rate constant k = a exp(-e_over_r / T) and the oxidant’s number density [X], and each row’s weight is multiplied by survival() of it. Give [X] as a constant or as a gridded field in a netCDF file, sampled at each row’s longitude, latitude, time and coordinate.

The loss must not depend on the tracer itself. Methane’s lifetime against OH is about nine years, so over a few days of trajectory it changes a weight by less than 0.1 %; the transform matters for shorter lived species and long trajectories.

Methods#

apply(particles[, release, directory])

Return the particles with weight scaled by the surviving fraction.

check(releases[, directory])

Return what is wrong with the oxidant file, for a stage's check to report.

field([directory])

Return the oxidant field, read from its file.

rate(particles[, directory])

Return the loss rate at each row, in s⁻¹.