= PDAF-OMI, the Observation Module Infrastructure =
{{{
#!html
}}}
[[PageOutline(2-3,Contents of this page)]]
PDAF-OMI (Observation Module Infrastructure) provides a structured and modularized approach to implement the observation handling for PDAF. It was introduced with PDAF V1.16 and is now the recommended standard for implementations. However, one can also [wiki:ImplementationofAnalysisStep_noOMI implement the assimilation without using PDAF-OMI], but using the full interface routines requires significantly more programming.
PDAF-OMI permits to implement the observation handling with limited number of user-provided routines. In addition, each observation type is encapsulated in a Fortran module (referred to as 'observation module'). With this, the implementations of different observation types cannot interfere which each other. The code strucutre is motivated from object-oriented programming, but we avoid here the abstract level of object-orientation in Fortran.
To guarantee that each observation type (like sea surface temperature data from some satellite sensor, or altimetry data) is handled independently from the others one implements with OMI one Fortran module for each observation type. Thus, different developers can implement observation types without interfering with the implementations by others.
Only two routines (in the case of global ensemble filters) or three routines (in the case of localized ensemble filters) need to be implemented for an observation type. Always required are:
- '''init_dim_obs'''[[br]]
Reads observations from a file and initialize the information describing the observations
- '''obs_op'''[[br]]
Calls an observation operator routine
For the domain localized filters LETKF/LESTKF/LNETF/LKNETF one more routine is required:
- '''init_dim_obs_l''' [[br]]
Calls a generic routine to initialize local observations
For the localized EnKF, instead of `init_dim_obs_l` the following routine is used:
- '''localize_covar'''[[br]]
Calls a generic routine to apply covariance localization
Only in the case of '''3D-Var''', two more routines are required:
- '''obs_op_lin'''[[br]]
Calls a routine for the linearized observation operator (equal to `obs_op` if this is linear)
- '''obs_op_adj'''[[br]]
Calls a routine for the adjoint observation operator
The only 'real' coding effort will be in '''init_dim_obs''' because the other routines merely call a subroutine provided by PDAF-OMI. All functionality needed during the analyis step bases on variables that are initialized by these routines and is provided by PDAF-OMI.
== Main Components of OMI ==
The main components of OMI are
- '''Observation Modules'''[[br]]
One observation-specific Fortran module for each observation type
- '''callback_obs_pdafomi.F90'''[[br]]
PDAF can only call a generic call-back routine for the different functionaliteis, e.g. `init_dim_obs_pdafomi` or `obs_op_pdafomi`. This file contains these generic call-back routines, in which the observation-specific subroutines of the differnt observation modules are called. Thus, the subroutines in this file are merely pass-through routines without own functionality.
- '''PDAF-OMI core routines'''[[br]]
These routines are part of the PDAF library and provide functionality for observation handling, localization, and observation operators
Figure 1 shows the call structure for the analysis step with PDAF-OMI. For the analysis step, the core routines of PDAF (green) call different user-provided call-back functions. Some of these routines, like those performing state localization, that are not related to observations (blue). PDAF-OMI is concerned with the routines related to observations (red and purple).
[[Image(//pics/PDAFstructure_PDAF-OMI_PDAF2.3.png)]]
[[BR]]'''Figure 1:''' Call-structure of PDAF with OMI: (green) PDAF library with core and omi; (blue) call-back routines; (red) OMI call-back routines; (purple) observation-specific modules. If [wiki:PDAFlocal_overview PDAFlocal] is not used, there will be two additional routines `g2l_state` and `l2g_state` relating to localization.
With OMI, the functionality to handle observations is included in generic routines and observation-specific modules (obs_*_pdafomi in the third column in Fig. 1, denoted obs-module below). Based on the information initialized in the call-back routines, PDAF can perform further observation handling internally. Only the routines mentioned above that perform observation-specific operations (initialization, observation operator, localization) need to be implemented. There is one obs-module per observation type with contains these routines. For example, one can have one obs-module for the satellite sea surface temperature from one data provider and another one for sea level anomaly data. Important is that each of these obs-modules, which are further described below, is independent from the others. This allows us to switch between different combinations of observations ensuring that their implementations don’t interfere.
Since the actual operations are performed in the obs-modules `obs_*_pdafomi`, the generic call-back routines (init_dim_obs_pdafomi, obs_op_pdafomi, init_dim_obs_l_pdafomi, localize_covar_pdafomi) are reduced to pass-through routines. Thus, each of these routines contains only calls to one observation-specific routine from each obs-module.
Because the generic call-back routines are very compact, they are collected into the file `callback_obs_pdafomi.F90`. This is mainly for convenience, because all these routines are now ‘in one place’. Thus, when adding a new observation type only a new subroutine call has to be added to each of the routines in this file. (Note, that callback_obs_pdafomi.F90 does not define a Fortran module. This is because the call-back routines of PDAF are not contained in a module as this would require to compile the module together with the PDAF core so that the PDAF core would no longer be generic.)
Each obs-module contains four routines:
1. `init_dim_obs` initializes all variables holding the information about one observation type.
1. `obs_op` applies the observation operator to a state vector. One can call an observation operator routine provided by PDAF-OMI, or one can to implement a new operator.
1. `init_dim_obs_l` calls a PDAF-OMI routine to initialize the observation information corresponding to a local analysis domain. One can set localization parameters, like the localization radius, for each observation type.
1. `localize_covar` calls a PDAF-OMI routine to apply covariance localization for the LEnKF. One can set localization parameters, like the localization radius, for each observation type.
For each observation type, PDAF-OMI uses a data structure (Fortran 'type') that is initialized in `init_dim_obs` in the obs-module. The set of routines in `callback_obs_pdafomi.F90` provide the observation handling for all filters and smoothers provided by PDAF. Thus, once the routines in an obs-module are implemented for a particular observation and the subroutine calls in `callback_obs_pdafomi.F90` for this observation type are inserted, one can use this observation type with all of PDAF's assimilation methods.
Note that `init_dim_obs_l` is only required if one plans to use domain-localized filters like LESTKF, LETKF or LNETF. Likewise, `localize_covar` is only required if on likes to use the loalized EnKF (LEnKF).
== Further documentation of PDAF-OMI ==
The documentation for implementing is provided on the following pages:
- [wiki:OMI_Callback_obs_pdafomi The file callback_obs_pdafomi.F90]
- [wiki:OMI_observation_modules The Observation Modules]
- [wiki:OMI_observation_operators Observation Operators]
- [wiki:OMI_debugging Debugging Functionality]
- [wiki:OMI_ImplementationofAnalysisStep Implementing the analysis step with OMI]
- [wiki:ImplementAnalysisLocal Implementation for Local Filters]
- [wiki:ImplementAnalysisGlobal Implementation for Global Filters]
- [wiki:ImplementAnalysislenkfOmi Implementation for localized EnKF]
- [wiki:Porting_to_OMI Porting an existing implementation to OMI]
- [wiki:PDAFomi_additional_functionality Additional functionality of OMI]
== Implementation examples ==
From PDAF V1.16, the PDAF package provides several implementation examples:
- '''/tutorial/online_2D_serialmodel'''[[BR]]
This implementation includes three obs-modules. The two modules `obs_A_pdafomi.F90` and `obs_B_pdafomi.F90` are for observation at grid points, while `obs_C_pdafomi.F90` uses an observation operator with bi-linear interpolation. In this case we have only implemented support for the global and the domain-localized filters, but not the LEnKF (see /models/lorenz96_omi for the example supporting all filters)
- '''/tutorial/online_2D_parallelmodel'''[[BR]]
This implementation includes two obs-modules (`obs_A_pdafomi.F90`, `obs_B_pdafomi.F90`) for observations at grid points. One can compare these modules with those in online_2D_serialmodel_omi to see differences in the case of a serial model to those in a parallel model
- '''/models/lorenz96'''[[br]]
This implementation uses one obs-module for observations at grid points. The implementation supports all filters that are available in PDAF. This variant uses the flexible parallelization variant (PDAFomi_put_state_X).
== Some Known Limitations ==
The current version of PDAF-OMI has a few limitations
- PDAF V2.3 added support for non-diagonal observation error covariance matrices **R** while previous versions only supported diagonal observation error covariance matrices (though, the observation variances can vary). Using nondiagonal **R**-matrices, requires a user-supplied code for operations relating to **R** (see the documentation on the implemenetation for [wiki:OMI_nondiagonal_observation_error_covariance_matrices using non-diagonal R-matrices with OMI])
- OMI currently only includes observation operators with linear interpolation and for observation located at grid points.
- We have not tested interoperability with other programming languages. Generally Fortran derived data types and C structs should be compatible. Obviously, taking the Fortran routines and calling C functions to perform the actual initializations will work.