Cycle Integration¶
Sequential assimilation — forecast, observe, analyse, repeat — is
orchestrated by pipekit-cycle, not
reimplemented here. The two factories on this page are thin wrappers that
assemble a pipekit_cycle.DACycle (filtering) or
pipekit_cycle.SmootherCycle (fixed-lag smoothing) from vardax parts: any
model's .as_analysis_step(), any
observation operator, and a forward model satisfying
the ForwardModel Protocol.
Because the coupling is purely structural (runtime-checkable Protocols, no
inheritance), the same cycle accepts every vardax method interchangeably —
swapping 3DVar for
strong-constraint 4DVar inside a cycle is a
one-argument change. The full forecast/analysis loop is worked through in
Six-Step Inference Cycle. Both factories are also
accessible via the vardax.cycle submodule namespace.
Factories¶
vardax — Modular variational data assimilation with learned components.
All public symbols are re-exported from the private _src subpackage so
that user code imports from the top-level namespace:
VarDACycle
¶
VarDACycle(
forward: Any,
obs_op: Any,
model: Any,
*,
obs_source: Any | None = None,
n_steps: int = 1,
save_history: bool = True,
) -> DACycle
Build a pipekit_cycle.DACycle from a vardax model.
Pulls model.as_analysis_step() and hands it to pipekit-cycle.
The same orchestration code works for any of the seven Layer 2
classes — OptimalInterpolation, ThreeDVar, StrongFourDVar,
WeakFourDVar, IncrementalFourDVar, FourDVarNet,
AmortizedPosterior.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
forward
|
Any
|
Forward model satisfying |
required |
obs_op
|
Any
|
Observation operator satisfying
|
required |
model
|
Any
|
Vardax Layer 2 model exposing |
required |
obs_source
|
Any | None
|
Optional |
None
|
n_steps
|
int
|
Number of forecast-analysis cycles per call. |
1
|
save_history
|
bool
|
Append |
True
|
Returns:
| Type | Description |
|---|---|
DACycle
|
Configured |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If |
Examples:
>>> import equinox as eqx
>>> import jax, jax.numpy as jnp, lineax as lx
>>> import vardax as vdx
>>> class IdentityForward(eqx.Module):
... dt: float = 1.0
... state_signature: None = None
...
... def step(self, state, dt):
... return state
>>> eye = lx.IdentityLinearOperator(jax.ShapeDtypeStruct((1, 4), jnp.float32))
>>> oi = vdx.OptimalInterpolation(
... obs_op=vdx.LinearObs(H_mat=eye),
... prior_mean=jnp.zeros((1, 4)),
... prior_cov_op=eye,
... obs_cov_op=eye,
... )
>>> cycle = vdx.VarDACycle(
... forward=IdentityForward(),
... obs_op=vdx.MaskedIdentity(),
... model=oi,
... n_steps=1,
... )
>>> type(cycle).__name__
'DACycle'
Source code in src/vardax/_src/cycle/da_cycle.py
VarSmootherCycle
¶
VarSmootherCycle(
forward: Any,
obs_op: Any,
model: Any,
*,
window: int,
stride: int = 1,
obs_source: Any | None = None,
) -> SmootherCycle
Build a pipekit_cycle.SmootherCycle from a vardax model.
Retrospective windowed smoothing: the model analyses each
window-step window, sliding by stride between consecutive
windows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
forward
|
Any
|
Forward model. |
required |
obs_op
|
Any
|
Observation operator. |
required |
model
|
Any
|
Vardax Layer 2 model exposing |
required |
window
|
int
|
Number of forecast steps per smoother window. |
required |
stride
|
int
|
Step between consecutive window starts. |
1
|
obs_source
|
Any | None
|
Optional observation loader. |
None
|
Returns:
| Type | Description |
|---|---|
SmootherCycle
|
Configured |