Skip to content

enkf⚓︎

EnKF type schemes

EnKF ⚓︎

Bases: AssimilationScheme

Ensemble Kalman Filter (EnKF).

Assimilates data sequentially, updating the state once per group of observations in the order given by assimindex. Each update applies the Kalman equations with the covariances approximated from the ensemble:

.. math::

m \leftarrow m + C_{md} (C_{dd} + C_d)^{-1} (d_{obs} - g(m))

There is no damping and no rejection: every step is accepted, and the run ends once the data groups are exhausted.

Parameters:

Name Type Description Default
keys_da dict

Parsed dataassim configuration. Besides the keys every scheme reads -- data, datavar, obsname, truedataindex -- the ones this scheme acts on are listed under Notes.

required
keys_en dict

Parsed ensemble configuration: ensemble size ne, the state variable names, and the prior_<name> blocks describing each.

required
sim object

Forward simulator instance, e.g. simulator.opm.flow.

required
analysis (approx, full, subspace)

Analysis flavour, i.e. how the ensemble-approximated sensitivity is inverted. Defaults to the analysis key in keys_da, falling back to 'approx'. The flavours differ in cost and in how they handle a rank-deficient ensemble; they solve the same update equation.

'approx'

Attributes:

Name Type Description
ensemble AssimilationEnsemble

Collaborator holding the state realisations, observed data and simulator. Its state is exposed as properties on the scheme, so scheme.enX and scheme.keys_da read straight through.

analysis AnalysisBase

The bound analysis object. Note the constructor takes analysis as a name and this attribute holds the resulting object, the way Model(optimizer="adam").optimizer is an optimizer instance.

analysis_name str

The flavour name that was resolved, e.g. 'approx'.

iteration int

Accepted iterations completed so far.

data_misfit, prior_data_misfit float

Current and initial mean data misfit.

Notes

assimindex determines the grouping and ordering of the sequential updates. If all data are to be assimilated in a single step, use :class:ES, which is this scheme specialised to one group.

energy sets the fraction of singular values retained in the truncated SVD (default 0.98); values above 1 are read as percentages.

Every data group is assimilated exactly once, so the prior-increment term that distinguishes full from approx is never reached: "full" is pointed at the same class as "approx" in :attr:COMPATIBLE_ANALYSES. :class:ES inherits this.

Examples:

>>> result = EnKF.assimilate(keys_da, keys_en, flow(keys_sim))
References

Evensen, Data Assimilation: The Ensemble Kalman Filter evensen2009a.

See Also

ES : All-data-at-once form of the same update.

__init__(keys_da, keys_en, sim, analysis=None, ensemble=None) ⚓︎

Build the ensemble from the config and bind the analysis.

See the class docstring for the parameters.

calc_analysis() ⚓︎

Calculate the analysis step of the EnKF procedure. The updating is done using the Kalman filter equations, using svd for numerical stability. Localization is available.

check_convergence() ⚓︎

The EnKF runs its full sweep of data groups; nothing stops early.

score_and_commit() ⚓︎

Calculate the "convergence" of the method. Important to

update_step() ⚓︎

Run one EnKF step: analysis, forecast, then score and commit.

Returns:

Type Description
bool

Always True. The EnKF applies one update per data group and has no rejection path.