endas.algorithms.EnsembleKalmanFilter¶
-
class
endas.algorithms.
EnsembleKalmanFilter
(variant, ensemble_size, loc_strategy=None, cov_inflation=1.0, lag=0, forgetting_factor=1.0, cache=None)¶ Bases:
object
Ensemble Kalman Filter.
This is a generic Ensemble Kalman Filter (EnKF) implementation that covers many of the EnKF variants. Ensemble Kalman Smoother (EnKS) is also implemented via the smoothing API. The filter/smoother allows both for global and localized analysis to be computed, the latter is always performed by partitioning the state space into a set of disjoint domains that are processed independently.
Parameters: - variant – Instance of the EnKFVariant class implementing the actual EnkF filter update
- ensemble_size – Size of the ensemble used
- loc_strategy – Localization strategy instance or
None
. - cov_inflation – Covariance inflation factor as a number greater or equal to 1.0. The default is 1.0, meaning no covariance inflation is applied.
- lag – The lag length of the fixed-lag Kalman Smoother as a number of time steps. Zero Lag disables smoothing
- forgetting_factor – Forgetting factor applied by the smoother, the value must be less or equal to 1.0.
- cache – Large array cache instance or
None
. IfNone
is given, an internal memory cache will be used.
See the DA Algorithms (endas.algorithms) page for information about implemented EnKF variants.
-
assimilate
(z, z_coords, H, R, executor=None)¶ Assimilates observations as part of the analysis update.
Parameters: - z – Array of observations (values).
- z_coords – Observation coordinates. See below for more information.
- H – Observation operator, must be an instance of
endas.ObservationOperator
. - R – Observation error covariance, must be an instance of
endas.CovarianceOperator
.
Returns: Nothing
The
z_coords
parameter contains “locations” of observations in the observation vectorz
and is only required when performing domain-based local analysis vialocalize()
. What can be passed forz_coords
depends on the state space partitioning (StateSpacePartitioning
) used for the localization, please check the documentation of the state space partitioning you are using for information. If the analysis is not localized,None
can be passed forz_coords
.
-
begin_analysis
(A, t=None)¶ Initiates the analysis update step.
At each time step, the analysis update must be initiated by a call to
begin_analysis()
, followed by one or more calls toassimilate()
. After all observations have been assimilated for the current time step,end_analysis()
must be called.Parameters: - A – Array representing the forecast ensemble at current time step
- t – Time corresponding to the current filter/smoother step
Returns: Nothing
-
localize
(loc_strategy)¶ Applies localization to the Ensemble Kalman Filter.
Parameters: loc_strategy – Localization strategy instance or None
.Returns: Nothing Calling
localize()
is equivalent to passingloc_strategy
to the__init__
method. Please note that the method must be called beforesmoother_begin()
orbegin_analysis()
is called.
-
smoother_begin
(A0, t0)¶ Must be called once at the beginning when smoothing solution is being calculated.
When the smoothing solution is calculated (i.e. with
lag > 0
), this method must be called to initialize the smoother. This method does nothing if only the filtering solution is calculated (i.e.lag==0
).Parameters: - A0 – Array representing the initial ensemble.
- t0 – Time corresponding to the initial time step.
Returns: Nothing