API Reference#

Purpose#

pyesmda is an open-source, and object-oriented library that provides a user friendly implementation of one of the most popular ensemble based method for parameters estimation and data assimilation: the Ensemble Smoother with Multiple Data Assimilation (ES-MDA) algorithm, introduced by Emerick and Reynolds [1-2].

The following functionalities are directly provided on module-level.

Classes#

ESMDA implementations.

ESMDA(obs, ...], ...)

Ensemble Smoother with Multiple Data Assimilation.

ESMDA_RS(obs, ...], ...)

Restricted Step Ensemble Smoother with Multiple Data Assimilation.

ESMDA_DMC(obs, ...], ...)

Data Misfit Controller Ensemble Smoother with Multiple Data Assimilation.

Selection of the inversion computation:

ESMDAInversionType(*values)

Inversion type for the computation of \(\mathbf{C}_{\mathrm{md}} (\mathbf{C}_{\mathrm{dd}} + \alpha \mathbf{C}_{\mathrm{d}})^{-1} (\mathbf{d} - \mathbf{Y})\).

Objective functions#

ls_cost_function(pred, obs, cov_obs)

Compute the normalized objective function for a given member \(j\).

Covariance approximation#

get_anomaly_matrix(ensemble)

Return the zero-mean (i.e., centered) anomaly matrix of the ensemble.

get_ensemble_variance(ensemble)

Get the given ensemble variance (diagonal terms of the covariance matrix).

empirical_covariance_upper(ensemble)

Compute the upper triangular part of the empirical covariance matrix X.

approximate_covariance_matrix_from_ensembles(...)

Approximate the covariance matrix between two ensembles in the EnKF way.

inflate_ensemble_around_its_mean(ensemble, ...)

Inflate the given parameter ensemble around its mean.

Localization#

Classes to parametrize the localization in a flexible way.

LocalizationStrategy()

Abstract class for localization strategy.

NoLocalization()

Instance to use when no localization is to be applied.

FixedLocalization([correlation_matrix])

Fixed localization strategy.

Correlation functions#

distances_to_weights_beta_cumulative(distances)

Transform the distances into weights between 0 and 1 with a beta function.

distances_to_weights_fifth_order(distances)

Transform the distances into weights between 0 and 1 with a fifth order function.

Other functions#

check_nans_in_predictions(d_pred, ...)

Check and raise an exception if there is any NaNs in the input predictions array.