pyPDAF.PDAF.generate_obs

pyPDAF.PDAF.generate_obs()

Generation of synthetic observations based on given error statistics and observation operator.

When diagonal observation error covariance matrix is used, it is recommended to use pyPDAF.PDAF.omi_generate_obs() functionalities for fewer user-supplied functions and improved efficiency.

The generated synthetic observations are based on each member of model forecast. Therefore, an ensemble of observations can be obtained. In a typical experiment, one may only need one ensemble member. The implementation strategy is similar to an assimilation step. This means that, one can reuse many user-supplied functions for assimilation and observation generation.

The function is a combination of pyPDAF.PDAF.put_state_generate_obs() and pyPDAF.PDAF.get_state().

This function executes the user-supplied function in the following sequence:
  1. py__collect_state_pdaf

  2. py__prepoststep_state_pdaf

  3. py__init_dim_obs_pdaf

  4. py__obs_op_pda

  5. py__init_obserr_f_pdaf

  6. py__get_obs_f_pdaf

  7. py__prepoststep_state_pdaf

  8. py__distribute_state_pdaf

  9. py__next_observation_pdaf

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__get_obs_f_pdaf (Callable[step:int, dim_obs_f:int, observation_f : ndarray[tuple[dim_obs_f], np.float64]]) –

    Provide observation vector to user

    Callback Parameters
    • stepint
      • Current time step

    • dim_obs_fint
      • Size of the full observation vector

    • observation_fndarray[tuple[dim_obs_f], np.float64]
      • Full vector of synthetic observations (process-local)

    Callback Returns
    • observation_fndarray[tuple[dim_obs_f], np.float64]
      • Full vector of synthetic observations (process-local)

  • py__init_obserr_f_pdaf (Callable[step:int, dim_obs_f:int, obs_f : ndarray[tuple[dim_obs_f], np.float64], obserr_f : ndarray[tuple[dim_obs_f], np.float64]]) –

    Initialize vector of observation error standard deviations

    Callback Parameters
    • stepint
      • Current time step

    • dim_obs_fint
      • Full dimension of observation vector

    • obs_fndarray[tuple[dim_obs_f], np.float64]
      • Full observation vector

    • obserr_fndarray[tuple[dim_obs_f], np.float64]
      • Full observation error stddev

    Callback Returns
    • obserr_fndarray[tuple[dim_obs_f], np.float64]
      • Full observation error stddev

  • 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__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