Skip to content

Adapters

Classes that structurally satisfy the pipekit_cycle ObservationOperator protocol. plumax does not import pipekit_cycle at runtime. The ForwardModel over an EulerianDispersionRHS is integrix.march.DiffraxForwardModel(rhs, solver=diffrax.Euler(), dt0=dt, dt=dt), as the module docstring below shows.

adapters

Data-assimilation adapters for the pipekit_cycle protocols.

pipekit_cycle decomposes data assimilation into three runtime-checkable protocols — ForwardModel (predict), ObservationOperator (compare), AnalysisStep (update). plumax ships adapters that satisfy them structurally: the class below exposes exactly the right methods / properties, so isinstance(obj, ObservationOperator) succeeds, without plumax importing pipekit_cycle at runtime. This keeps the dependency arrow pointing the right way — assimilation drivers depend on plumax, not the reverse.

  • :class:RadtranObservationOperator — wraps the normalised Beer–Lambert forward model as an ObservationOperator mapping a scalar plume enhancement (ΔVMR) to a normalised radiance spectrum, with its jax.jacfwd as the tangent-linear.

A ForwardModel over an :class:~plumax.les_fvm.EulerianDispersionRHS is integrix.march.DiffraxForwardModel, which takes any diffrax solver; with diffrax.Euler and dt0 = dt one step is one explicit-Euler step, c ← c + Δt · RHS(0, c)::

import diffrax as dfx
from integrix.march import DiffraxForwardModel

forward = DiffraxForwardModel(rhs, solver=dfx.Euler(), dt0=1.0, dt=1.0)
# (Nz, Ny, Nx), integrated over [0, Δt]
next_c = forward.step(c, 1.0)
# (Nz, Ny, Nx), over [t₀, t₀ + Δt] at the true time
next_c = forward.as_dynamics()(c, t0, t0 + 1.0)

RadtranObservationOperator

RadtranObservationOperator(ds: Dataset, nu_obs: Float[ArrayLike, ' G'], *, T_K: float, p_atm: float, path_length_cm: float, amf: float, var: str = 'absorption_cross_section')

Bases: Module

Expose the normalised Beer–Lambert forward as an ObservationOperator.

H(ΔVMR) answers "what normalised radiance spectrum would a plume enhancement of ΔVMR produce?". The innovation in a retrieval is then observed_spectrum - H(ΔVMR_forecast). It is the one-receptor case of :class:plumax.coupled.RadianceObservationOperator without an SRF, taken in ΔVMR rather than column mass, and :meth:linearize is its jax.jacfwd.

Parameters:

Name Type Description Default
ds Dataset

Absorption-cross-section LUT dataset.

required
nu_obs Float[ArrayLike, ' G']

Observation wavenumbers [cm⁻¹].

required
T_K float

Layer temperature [K].

required
p_atm float

Layer pressure [atm].

required
path_length_cm float

Optical path length [cm].

required
amf float

Air-mass factor.

required
var str

LUT cross-section variable name.

'absorption_cross_section'

Attributes:

Name Type Description
operator RadianceObservationOperator

The slab operator on nu_obs.

Source code in src/plumax/_src/adapters.py
def __init__(
    self,
    ds: xr.Dataset,
    nu_obs: Float[ArrayLike, " G"],
    *,
    T_K: float,
    p_atm: float,
    path_length_cm: float,
    amf: float,
    var: str = "absorption_cross_section",
) -> None:
    self.operator = RadianceObservationOperator(
        ds,
        nu_obs=nu_obs,
        T_K=T_K,
        p_atm=p_atm,
        path_length_cm=path_length_cm,
        amf=amf,
        var=var,
    )

linearize

linearize(state: Any) -> jax.Array

Return the tangent-linear d(L_norm)/d(ΔVMR) at state.

Source code in src/plumax/_src/adapters.py
def linearize(self, state: Any) -> jax.Array:
    """Return the tangent-linear ``d(L_norm)/d(ΔVMR)`` at ``state``."""
    return jax.jacfwd(self.operator.predict_delta_vmr)(
        jnp.asarray(state, dtype=float)
    )