pyPDAF.PDAF.assimilate_enkf¶
- pyPDAF.PDAF.assimilate_enkf()¶
It is recommended to use
pyPDAF.PDAF.omi_assimilate_global()
orpyPDAF.PDAF.omi_assimilate_enkf_nondiagR()
.PDAF-OMI modules require fewer user-supplied functions and improved efficiency.
Stochastic EnKF (ensemble Kalman filter) [1] for a single DA step without OMI. This function should be called at each model time step.
The function is a combination of
pyPDAF.PDAF.put_state_enkf()
andpyPDAF.PDAF.get_state()
.- User-supplied functions are executed in the following sequence:
py__collect_state_pdaf
py__prepoststep_state_pdaf
py__init_dim_obs_pdaf
py__obs_op_pdaf (for ensemble mean)
py__add_obs_err_pdaf
py__init_obs_pdaf
py__init_obscovar_pdaf
py__obs_op_pdaf (for each ensemble member)
core DA algorithm
py__prepoststep_state_pdaf
py__distribute_state_pdaf
py__next_observation_pdaf
Deprecated since version 1.0.0: This function is replaced by
pyPDAF.PDAF.omi_assimilate_global()
andpyPDAF.PDAF.omi_assimilate_enkf_nondiagR()
References
- Parameters:
py__collect_state_pdaf (Callable[dim_p:int, state_p : ndarray[tuple[dim_p], np.float64]]) –
Collect state vector from model/any arrays to pdaf arrays
- Callback Parameters
- dim_pint
pe-local state dimension
- state_pndarray[tuple[dim_p], np.float64]
local state vector
- Callback Returns
- state_pndarray[tuple[dim_p], np.float64]
local state vector
py__distribute_state_pdaf (Callable[dim_p:int, state_p : ndarray[tuple[dim_p], np.float64]]) –
distribute a state vector from pdaf to the model/any arrays
- Callback Parameters
- dim_pint
PE-local state dimension
- state_pndarray[tuple[dim_p], np.float64]
PE-local state vector
- Callback Returns
- state_pndarray[tuple[dim_p], np.float64]
PE-local state vector
py__init_dim_obs_pdaf (Callable[step:int, dim_obs_p:int]) –
The primary purpose of this function is to obtain the dimension of the observation vector. In OMI, in this function, one also sets the properties of obs_f, read the observation vector from files, setting the observation error variance when diagonal observation error covariance matrix is used. The pyPDAF.PDAF.omi_gather_obs function is also called here.
- Callback Parameters
- stepint
current time step
- dim_obs_pint
dimension of observation vector
- Callback Returns
- dim_obs_pint
dimension of observation vector
py__obs_op_pdaf (Callable[step:int, dim_p:int, dim_obs_p:int, state_p : ndarray[tuple[dim_p], np.float64], m_state_p : ndarray[tuple[dim_obs_p], np.float64]]) –
Observation operator
- Callback Parameters
- stepint
Current time step
- dim_pint
Size of state vector (local part in case of parallel decomposed state)
- dim_obs_pint
Size of PE-local observation vector
- state_pndarray[tuple[dim_p], np.float64]
Model state vector
- m_state_pndarray[tuple[dim_obs_p], np.float64]
Observed state vector (i.e. the result after applying the observation operator to state_p)
- Callback Returns
- m_state_pndarray[tuple[dim_obs_p], np.float64]
Observed state vector (i.e. the result after applying the observation operator to state_p)
py__init_obs_pdaf (Callable[step:int, dim_obs_p:int, observation_p : ndarray[tuple[dim_obs_p], np.float64]]) –
Initialize observation vector
- Callback Parameters
- stepint
Current time step
- dim_obs_pint
Size of the observation vector
- observation_pndarray[tuple[dim_obs_p], np.float64]
Vector of observations
- Callback Returns
- observation_pndarray[tuple[dim_obs_p], np.float64]
Vector of observations
py__prepoststep_pdaf (Callable[step:int, dim_p:int, dim_ens:int, dim_ens_l:int, dim_obs_p:int, state_p : ndarray[tuple[dim_p], np.float64], uinv : ndarray[tuple[dim_ens-1, dim_ens-1], np.float64], ens_p : ndarray[tuple[dim_p, dim_ens], np.float64], flag:int]) –
Preprocesse the ensemble before analysis and postprocess the ensemble before distributing to the model for next forecast
- Callback Parameters
- stepint
current time step (negative for call before analysis/preprocessing)
- dim_pint
PE-local state vector dimension
- dim_ensint
number of ensemble members
- dim_ens_lint
number of ensemble members run serially on each model task
- dim_obs_pint
PE-local dimension of observation vector
- state_pndarray[tuple[dim_p], np.float64]
pe-local forecast/analysis state (the array ‘state_p’ is generally not initialised in the case of ESTKF/ETKF/EnKF/SEIK, so it can be used freely here.)
- uinvndarray[tuple[dim_ens-1, dim_ens-1], np.float64]
Inverse of the transformation matrix in ETKF and ESKTF; inverse of matrix formed by right singular vectors of error covariance matrix of ensemble perturbations in SEIK/SEEK. not used in EnKF.
- ens_pndarray[tuple[dim_p, dim_ens], np.float64]
PE-local ensemble
- flagint
pdaf status flag
- Callback Returns
- state_pndarray[tuple[dim_p], np.float64]
pe-local forecast/analysis state (the array ‘state_p’ is generally not initialised in the case of ESTKF/ETKF/EnKF/SEIK, so it can be used freely here.)
- uinvndarray[tuple[dim_ens-1, dim_ens-1], np.float64]
Inverse of the transformation matrix in ETKF and ESKTF; inverse of matrix formed by right singular vectors of error covariance matrix of ensemble perturbations in SEIK/SEEK. not used in EnKF.
- ens_pndarray[tuple[dim_p, dim_ens], np.float64]
PE-local ensemble
py__add_obs_err_pdaf (Callable[step:int, dim_obs_p:int, C_p : ndarray[tuple[dim_obs_p, dim_obs_p], np.float64]]) –
Add obs error covariance R to HPH in EnKF
- Callback Parameters
- stepint
Current time step
- dim_obs_pint
Dimension of observation vector
- C_pndarray[tuple[dim_obs_p, dim_obs_p], np.float64]
Matrix to that observation covariance R is added
- Callback Returns
- C_pndarray[tuple[dim_obs_p, dim_obs_p], np.float64]
Matrix to that observation covariance R is added
py__init_obs_covar_pdaf (Callable[step:int, dim_obs:int, dim_obs_p:int, covar:float, obs_p : ndarray[tuple[dim_obs_p], np.float64], isdiag:bool]) –
Initialize obs. error cov. matrix R in EnKF
- Callback Parameters
- stepint
Current time step
- dim_obsint
Global size of observation vector
- dim_obs_pint
Size of process-local observation vector
- covarfloat
Observation error covariance matrix
- obs_pndarray[tuple[dim_obs_p], np.float64]
Process-local vector of observations
- isdiagbool
- Callback Returns
- covarfloat
Observation error covariance matrix
- isdiagbool
py__next_observation_pdaf (Callable[stepnow:int, nsteps:int, doexit:int, time:float]) –
Routine to provide number of forecast time steps until next assimilations, model physical time and end of assimilation cycles
- Callback Parameters
- stepnowint
the current time step given by PDAF
- nstepsint
number of forecast time steps until next assimilation; this can also be interpreted as number of assimilation function calls to perform a new assimilation
- doexitint
whether to exit forecasting (1 for exit)
- timefloat
current model (physical) time
- Callback Returns
- nstepsint
number of forecast time steps until next assimilation; this can also be interpreted as number of assimilation function calls to perform a new assimilation
- doexitint
whether to exit forecasting (1 for exit)
- timefloat
current model (physical) time
- Returns:
flag – Status flag
- Return type:
int