# Overview of the Analysis Step of Ensemble Filters

#### PDAF-OMI Guide

- Overview
- callback_obs_pdafomi.F90
- Observation Modules
- Observation operators
- Checking error status
- Debugging functionality
- Implementing the analysis step with OMI
- General overview for ensemble filters
- General overview for 3D-Var methods
- Porting an existing implemention to OMI
- Additional OMI Functionality

#### Implementation Guide

For the analysis step of ensemble filters several routines need to be implemented. We prove a conceptional overview here. The detailed interfaces are then described on the following pages.

**Figure 1:** Required routines for the analysis step of ensemble filters. There are three groups of routines: The interface to the model (orange), the observation module (red), and state localization in case of domain-localized filters like LETKF/LESTKF/LNETF (purple).

Figure 1 gives an overview of the different routines that might need to be provided to the analysis step of an ensemble filter. The actual routines depend on the chosen filter method. The routines are organized in three groups:

## Model Interface

The model Interface consists of the routines

`collect_state_pdaf`

and`distribute_state_pdaf`

. These routine perform the concersion between model fields and state vector. The routines have been discussed in the context of the modification of the model for the ensemble integration.

## OMI Observation Module

The observation module performs all observation-related operations. In case of OMI, one needs the following routines:

`init_dim_obs_pdafomi`

: For each observation type that is assimilation this routine reads the observations and initialized observation values, coordinates, and errors. In addition indices are specified that link the state vector to the observations so that the observation operator is prepared`obs_op_pdafomi`

: For each observation type there is one routine providing the observation operator. For this, OMI provides different observation operators`init_dim_obs_l_pdafomi`

: This routine initializes the local observations of each observation type. This is only required for the domain-localized filters. With OMI this is mainly a single subroutine call, while OMI does the actual initialization`localized_covar`

: For the local EnKF the state error covariance matrix is localized. This is performed with this routine and is specified for each observation type.

More information about OMI can be found in the overview of PDAF-OMI.

## Localization

These routines are only required for the domain-localized ensemble filters. They handle the initialization of the state vector for a local analysis. These routines are

`init_n_domain`

: This routine sets the number of local analysis domains`init_dim_l`

: This routine determines the state vector size for the local analysis domain and initializes the index information to fill a local state vector`g2l_state`

: This routine performs the transformation from a global to the local state vector. It selects elements of the global state vector and fill the local vector`l2g_state`

: This routine performns the back-ttransformation from local to global state vector.

## Code examples in tutorial

The implementation of the ensemble filters is demonstrated in the tutorial codes in the PDAF package in the sub-directories of

tutorial/

The implementations are described in detail in the PDAF tutorial slide sets.

## Documention of the required implementations

There are three different routines that call the filter analysis step: