pyPDAF.PDAF.assimilate_lenkf

pyPDAF.PDAF.assimilate_lenkf()

It is recommended to use pyPDAF.PDAF.omi_assimilate_lenkf() or pyPDAF.PDAF.omi_assimilate_lenkf_nondiagR().

PDAF-OMI modules require fewer user-supplied functions and improved efficiency.

Stochastic EnKF (ensemble Kalman filter) with covariance localisation [1] for a single DA step without OMI.

This is the only scheme for covariance localisation in PDAF.

This function should be called at each model time step. The function is a combination of pyPDAF.PDAF.put_state_lenkf() and pyPDAF.PDAF.get_state().

The user-supplied function is executed in the following sequence:
  1. py__collect_state_pdaf

  2. py__prepoststep_state_pdaf

  3. py__init_dim_obs_pdaf

  4. py__obs_op_pdaf (for each ensemble member)

  5. py__localize_pdaf

  6. py__add_obs_err_pdaf

  7. py__init_obs_pdaf

  8. py__init_obscovar_pdaf

  9. py__obs_op_pdaf (repeated to reduce storage)

  10. core DA algorith

  11. py__prepoststep_state_pdaf

  12. py__distribute_state_pdaf

  13. py__next_observation_pdaf

Deprecated since version 1.0.0: This function is replaced by pyPDAF.PDAF.omi_assimilate_lenkf() and pyPDAF.PDAF.omi_assimilate_lenkf_nondiagR()

References

Parameters:
  • py__collect_state_pdaf (Callable[dim_p:int, state_p : ndarray[tuple[dim_p], np.float64]]) –

    Routine to collect a state vector

    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]]) –

    Routine to distribute a state vector

    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__init_dim_obs_pdaf (Callable[step:int, dim_obs_p:int]) –

    Initialize dimension of observation vector

    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 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_p: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]) –

    User supplied pre/poststep routine

    Callback Parameters
    • stepint
      • current time step (negative for call after forecast)

    • dim_pint
      • pe-local state dimension

    • dim_ensint
      • size of state ensemble

    • dim_ens_pint
      • pe-local size of ensemble

    • 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 not generally not initialized in the case of seik. it can be used freely here.)

    • uinvndarray[tuple[dim_ens-1, dim_ens-1], np.float64]
      • inverse of matrix u

    • ens_pndarray[tuple[dim_p, dim_ens], np.float64]
      • pe-local state ensemble

    • flagint
      • pdaf status flag

    Callback Returns
    • state_pndarray[tuple[dim_p], np.float64]
      • pe-local forecast/analysis state (the array ‘state_p’ is not generally not initialized in the case of seik. it can be used freely here.)

    • uinvndarray[tuple[dim_ens-1, dim_ens-1], np.float64]
      • inverse of matrix u

    • ens_pndarray[tuple[dim_p, dim_ens], np.float64]
      • pe-local state ensemble

  • py__localize_covar_pdaf (Callable[dim_p:int, dim_obs:int, hp_p : ndarray[tuple[dim_obs, dim_p], np.float64], hph : ndarray[tuple[dim_obs, dim_obs], np.float64]]) –

    Apply localization to HP and HPH^T

    Callback Parameters
    • dim_pint
      • pe-local state dimension

    • dim_obsint
      • number of observations

    • hp_pndarray[tuple[dim_obs, dim_p], np.float64]
      • pe local part of matrix hp

    • hphndarray[tuple[dim_obs, dim_obs], np.float64]
      • matrix hph

    Callback Returns
    • hp_pndarray[tuple[dim_obs, dim_p], np.float64]
      • pe local part of matrix hp

    • hphndarray[tuple[dim_obs, dim_obs], np.float64]
      • matrix hph

  • 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]) –

    Provide time step and time of next observation

    Callback Parameters
    • stepnowint
      • number of the current time step

    • nstepsint
      • number of time steps until next obs

    • doexitint
      • whether to exit forecasting (1 for exit)

    • timefloat
      • current model (physical) time

    Callback Returns
    • nstepsint
      • number of time steps until next obs

    • doexitint
      • whether to exit forecasting (1 for exit)

    • timefloat
      • current model (physical) time

Returns:

flag – Status flag

Return type:

int