| 1 | = likelihood_hyb_l_pdaf = |
| 2 | |
| 3 | The page document the user-supplied call-back routine `likelihood_hyb_l_pdaf`. |
| 4 | |
| 5 | The routine `likelihood_hyb_l_pdaf` (called `U_likelihood_hyb_l` inside the PDAF core routines) is a call-back routine that has to be provided by the user. In the simplified interface the predefined name of the routine is `likelihood_l_pdaf`, but in the full interface, the user can choose the name of the routine. |
| 6 | |
| 7 | This routine is a variant of [wiki:likelihood_l_pdaf] including the hybrid weight used for the [wiki:ImplementAnalysislknetf hybrid Kalman-nonlinear ensemble transform filter LKNETF]. If you already implemented [wiki:likelihood_l_pdaf] you can implement the hybrid variant by adding the hybrid weight `gamma` to the interface and add a multiplication with this value in the loop where `Rinvresid_l` is computed. |
| 8 | |
| 9 | The routine is used in the localized nonlinear filter LNETF and has to compute the likelihood of the observation for a given ensemble member according to the observations used for the local analysis. |
| 10 | The likelihood depends on the assumed observation error distribution. For a Gaussian observation error, the likelihood is '''exp(-0.5*(y-Hx)^T^*R^-1^*(y-Hx))''' for the local observations. The vector '''y-HX =''' `resid_l` is provided as an input argument. The likelihood has to be returned in the variable `likely_l`. |
| 11 | |
| 12 | This routine is also the place to perform observation localization. To initialize a vector of weights, the routine `PDAF_local_weight` can be called. The procedure is used in the example implementation and also demonstrated in the template routine. |
| 13 | |
| 14 | '''Difference to `likelihood_l_pdaf`:''' The routine also has to apply the hybrid weight gamma. This is a simple multiplication with the input value in the loop where `Rinvresid_l` is initialized. |
| 15 | |
| 16 | The interface is the following: |
| 17 | {{{ |
| 18 | SUBROUTINE likelihood_hyb_l_pdaf(domain_p, step, dim_obs_l, obs_l, resid_l, gamma, likely_l) |
| 19 | }}} |
| 20 | with |
| 21 | * `domain_p` : `integer, intent(in)`[[BR]] Index of current local analysis domain |
| 22 | * `step` : `integer, intent(in)`[[BR]] Current time step |
| 23 | * `dim_obs_l` : `integer, intent(in)`[[BR]] Number of local observations at current time step (i.e. the size of the local observation vector) |
| 24 | * `obs_l` : `real, intent(in), dimension(dim_obs_l)`[[BR]] Local vector of observations |
| 25 | * `gamma` : `real, intent(in)`[[BR]] Hybrid weight provided by PDAF |
| 26 | * `resid_l` : `real, intent(in), dimension(dim_obs_l)`[[BR]] Input vector holding the local residual |
| 27 | * `likely` : `real, intent(out)`[[BR]] Output value of the local likelihood |
| 28 | |
| 29 | Hints: |
| 30 | * The routine does not require that the product is implemented as a real matrix-vector product. Rather, the product can be implemented in its most efficient form. For example, if the observation error covariance matrix is diagonal, only the multiplication of the inverse diagonal with the vector `resid_l` has to be implemented. |
| 31 | * The observation vector `obs_l` is provided through the interface for cases where the observation error variance is relative to the actual value of the observations. |
| 32 | * To perform observation localization (i.e. observation weighting by modifying the inverse observation error covariance matrix) one computes for each observations the distance of it from the local analysis domain and then computes a weight for each observation according to this distance. For the computation of the weight, the routine `PDAF_local_weight` can be used. |