PDAF-OMI routines for local observations
This module contains generic routines for several observation-related operations for local filters. The routines are
Revision history: * 2019-06 - Lars Nerger - Initial code * Later revisions - see repository log
Set debugging flag
This routine sets the debug flag for PDAF-OMI. One can set the flag dependent on the local analysis domain, the MPI rank, or the OpenMP thread ID, or and combination of them.
For debugval>0 additional information is written by the OMI routine to stdout. One should activate the debugging before calling some selected routine(s) and deactivate it with debugval=0 afterwards. This allows for a targeted checking of the functionality.
Revision history: * 2019-09 - Lars Nerger - Initial code * Later revisions - see repository log
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(obs_arr_l), | public, | ALLOCATABLE | :: | obs_l_all(:) | |||
| integer, | public | :: | firstobs | = | 0 | ||
| integer, | public | :: | offset_obs_l | = | 0 |
Set dimension of local obs. vector and local obs. arrays
This routine sets the number of local observations for the current observation type for the local analysis domain with coordinates COORD_l and localization cut-off radius CRADIUS. Further the routine initializes arrays for the index of a local observation in the full observation vector and its corresponding distance. The operation are performed by calling the routines cnt_dim_obs_l and init_obsarrays_l.
Revision history: * 2019-06 - Lars Nerger - Initial code from restructuring observation routines * Later revisions - see repository log
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout), | TARGET | :: | thisobs_l | ||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(in) | :: | coords_l(:) | |||
| integer, | intent(in) | :: | locweight | |||
| real, | intent(in) | :: | cradius | |||
| real, | intent(in) | :: | sradius | |||
| integer, | intent(inout) | :: | cnt_obs_l |
Set dimension of local obs. vector and local obs. arrays (non-isotropic)
This routine sets the number of local observations for the current observation type for the local analysis domain with coordinates COORD_l and a vector of localization cut-off radii CRADIUS. Further the routine initializes arrays for the index of a local observation in the full observation vector and its corresponding distance. The operation are performed by calling the routines cnt_dim_obs_l and init_obsarrays_l.
Revision history: * 2024-02 - Lars Nerger - Initial code from restructuring observation routines * Later revisions - see repository log
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout), | TARGET | :: | thisobs_l | ||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(in) | :: | coords_l(:) | |||
| integer, | intent(in) | :: | locweight | |||
| real, | intent(in) | :: | cradius(:) | |||
| real, | intent(in) | :: | sradius(:) | |||
| integer, | intent(inout) | :: | cnt_obs_l |
Set dimension of local obs. vector and local obs. arrays
This routine is a variant of PDAFomi_init_dim_obs_l_noniso with support for a vector of localization weights. This is used to specify different localization functions for the vertical and horizontal directions. The routine only stores the value of locweights(2) for the vertical and calls PDAFomi_init_dim_obs_l_iso.
Revision history: * 2024-04 - Lars Nerger - Initial code * Later revisions - see repository log
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout), | TARGET | :: | thisobs_l | ||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(in) | :: | coords_l(:) | |||
| integer, | intent(in) | :: | locweights(:) | |||
| real, | intent(in) | :: | cradius(:) | |||
| real, | intent(in) | :: | sradius(:) | |||
| integer, | intent(inout) | :: | cnt_obs_l |
Apply covariance localization
This routine applies a localization matrix B to the matrices HP and HPH^T of the localized EnKF.
Revision history: * 2020-03 - Lars Nerger - Initial code from restructuring observation routines * Later revisions - see repository log
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_f), | intent(in) | :: | thisobs | |||
| integer, | intent(in) | :: | dim | |||
| integer, | intent(in) | :: | locweight | |||
| real, | intent(in) | :: | cradius | |||
| real, | intent(in) | :: | sradius | |||
| real, | intent(in) | :: | coords(:,:) | |||
| real, | intent(inout) | :: | HP(:,:) | |||
| real, | intent(inout) | :: | HPH(:,:) |
Apply covariance localization
This routine applies a localization matrix B to the matrices HP and HPH^T of the localized EnKF. This variant is for non-iceotropic localization
Revision history: * 2020-03 - Lars Nerger - Initial code from restructuring observation routines * Later revisions - see repository log
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_f), | intent(in) | :: | thisobs | |||
| integer, | intent(in) | :: | dim | |||
| integer, | intent(in) | :: | locweight | |||
| real, | intent(in) | :: | cradius(:) | |||
| real, | intent(in) | :: | sradius(:) | |||
| real, | intent(in) | :: | coords(:,:) | |||
| real, | intent(inout) | :: | HP(:,:) | |||
| real, | intent(inout) | :: | HPH(:,:) |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | dim_obs_l | ||||
| integer, | public | :: | off_obs_l | ||||
| integer, | public, | ALLOCATABLE | :: | id_obs_l(:) | |||
| real, | public, | ALLOCATABLE | :: | distance_l(:) | |||
| real, | public, | ALLOCATABLE | :: | cradius_l(:) | |||
| real, | public, | ALLOCATABLE | :: | sradius_l(:) | |||
| real, | public, | ALLOCATABLE | :: | ivar_obs_l(:) | |||
| real, | public, | ALLOCATABLE | :: | dist_l_v(:) | |||
| integer, | public | :: | locweight | ||||
| integer, | public | :: | locweight_v | = | 0 | ||
| integer, | public | :: | nradii | ||||
| real, | public, | ALLOCATABLE | :: | cradius(:) | |||
| real, | public, | ALLOCATABLE | :: | sradius(:) |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | debugval |
Set dimension of local obs. vector and local obs. arrays
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout), | TARGET | :: | thisobs_l | ||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(in) | :: | coords_l(:) | |||
| integer, | intent(in) | :: | locweight | |||
| real, | intent(in) | :: | cradius | |||
| real, | intent(in) | :: | sradius | |||
| integer, | intent(inout) | :: | cnt_obs_l |
Set dimension of local obs. vector and local obs. arrays (non-isotropic)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout), | TARGET | :: | thisobs_l | ||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(in) | :: | coords_l(:) | |||
| integer, | intent(in) | :: | locweight | |||
| real, | intent(in) | :: | cradius(:) | |||
| real, | intent(in) | :: | sradius(:) | |||
| integer, | intent(inout) | :: | cnt_obs_l |
Set dimension of local obs. vector and local obs. arrays
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout), | TARGET | :: | thisobs_l | ||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(in) | :: | coords_l(:) | |||
| integer, | intent(in) | :: | locweights(:) | |||
| real, | intent(in) | :: | cradius(:) | |||
| real, | intent(in) | :: | sradius(:) | |||
| integer, | intent(inout) | :: | cnt_obs_l |
Set dimension of local observation vector
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(in) | :: | coords_l(:) |
Set dimension of local observation vector for nonisotropic localization
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(in) | :: | coords_l(:) |
Initialize local arrays for an observation
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(in) | :: | coords_l(:) | |||
| integer, | intent(inout) | :: | off_obs_l_all |
Initialize local arrays for an observation for nonisotropic localization
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(in) | :: | coords_l(:) | |||
| integer, | intent(inout) | :: | off_obs_l_all |
Initialize local observation vector
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(in) | :: | obs_f_all(:) | |||
| real, | intent(inout) | :: | obs_l_all(:) |
Initialize local observation vector and inverse error variance
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(inout) | :: | obs_l_all(:) |
Compute mean observation error variance
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(inout) | :: | meanvar_l | |||
| integer, | intent(inout) | :: | cnt_obs_l |
Compute product of inverse of R with some matrix
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| integer, | intent(in) | :: | nobs_all | |||
| integer, | intent(in) | :: | ncols | |||
| real, | intent(inout) | :: | A_l(:,:) | |||
| real, | intent(out) | :: | C_l(:,:) | |||
| integer, | intent(in) | :: | verbose |
Compute product of inverse of R with some matrix and hybrid weight
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| integer, | intent(in) | :: | nobs_all | |||
| integer, | intent(in) | :: | ncols | |||
| real, | intent(in) | :: | gamma | |||
| real, | intent(inout) | :: | A_l(:,:) | |||
| real, | intent(out) | :: | C_l(:,:) | |||
| integer, | intent(in) | :: | verbose |
Compute local likelihood for an ensemble member
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(inout) | :: | resid_l(:) | |||
| real, | intent(inout) | :: | lhood_l | |||
| integer, | intent(in) | :: | verbose |
Compute local likelihood for an ensemble member using hybrid weight
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(inout) | :: | resid_l(:) | |||
| real, | intent(in) | :: | gamma | |||
| real, | intent(inout) | :: | lhood_l | |||
| integer, | intent(in) | :: | verbose |
Apply covariance localization
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_f), | intent(in) | :: | thisobs | |||
| integer, | intent(in) | :: | dim | |||
| integer, | intent(in) | :: | locweight | |||
| real, | intent(in) | :: | cradius | |||
| real, | intent(in) | :: | sradius | |||
| real, | intent(in) | :: | coords(:,:) | |||
| real, | intent(inout) | :: | HP(:,:) | |||
| real, | intent(inout) | :: | HPH(:,:) |
Apply covariance localization: 2+1D factorized with vertical localization weight
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_f), | intent(inout) | :: | thisobs | |||
| integer, | intent(in) | :: | dim | |||
| integer, | intent(in) | :: | locweights(:) | |||
| real, | intent(in) | :: | cradius(:) | |||
| real, | intent(in) | :: | sradius(:) | |||
| real, | intent(in) | :: | coords(:,:) | |||
| real, | intent(inout) | :: | HP(:,:) | |||
| real, | intent(inout) | :: | HPH(:,:) |
Apply covariance localization
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_f), | intent(in) | :: | thisobs | |||
| integer, | intent(in) | :: | dim | |||
| integer, | intent(in) | :: | locweight | |||
| real, | intent(in) | :: | cradius(:) | |||
| real, | intent(in) | :: | sradius(:) | |||
| real, | intent(in) | :: | coords(:,:) | |||
| real, | intent(inout) | :: | HP(:,:) | |||
| real, | intent(inout) | :: | HPH(:,:) |
Initialize local observation vector
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| real, | intent(in) | :: | obs_f_one(:) | |||
| integer, | intent(in) | :: | offset_obs_l_all | |||
| real, | intent(inout) | :: | obs_l_all(:) |
Compute square distance between two locations
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_f), | intent(in) | :: | thisobs | |||
| real, | intent(in) | :: | coordsA(:) | |||
| real, | intent(in) | :: | coordsB(:) | |||
| real, | intent(out) | :: | distance2 | |||
| integer, | intent(in) | :: | verbose |
Check distance in case of isotropic localization
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_f), | intent(in) | :: | thisobs | |||
| type(obs_l), | intent(in) | :: | thisobs_l | |||
| real, | intent(in) | :: | coordsA(:) | |||
| real, | intent(in) | :: | coordsB(:) | |||
| real, | intent(out) | :: | distance2 | |||
| logical, | intent(out) | :: | checkdist | |||
| integer, | intent(in) | :: | verbose | |||
| integer, | intent(inout) | :: | cnt_obs |
Check distance in case of nonisotropic localization
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_f), | intent(in) | :: | thisobs | |||
| type(obs_l), | intent(in) | :: | thisobs_l | |||
| real, | intent(in) | :: | coordsA(:) | |||
| real, | intent(in) | :: | coordsB(:) | |||
| real, | intent(out) | :: | distance2 | |||
| real, | intent(inout) | :: | dists(:) | |||
| real, | intent(out) | :: | cradius | |||
| real, | intent(inout) | :: | sradius | |||
| logical, | intent(out) | :: | checkdist | |||
| integer, | intent(in) | :: | verbose | |||
| integer, | intent(inout) | :: | cnt_obs |
Compute weight vector for localization
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | verbose | |||
| integer, | intent(in) | :: | nobs_l | |||
| integer, | intent(in) | :: | ncols | |||
| integer, | intent(in) | :: | locweight | |||
| real, | intent(in) | :: | cradius(:) | |||
| real, | intent(in) | :: | sradius(:) | |||
| real, | intent(in) | :: | matA(:,:) | |||
| real, | intent(in) | :: | ivar_obs_l(:) | |||
| real, | intent(in) | :: | dist_l(:) | |||
| real, | intent(out) | :: | weight_l(:) |
Compute weight vector for localization
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | verbose | |||
| integer, | intent(in) | :: | nobs_l | |||
| integer, | intent(in) | :: | ncols | |||
| integer, | intent(in) | :: | locweight | |||
| real, | intent(in) | :: | cradius | |||
| real, | intent(in) | :: | sradius | |||
| real, | intent(in) | :: | matA(:,:) | |||
| real, | intent(in) | :: | ivar_obs_l(:) | |||
| real, | intent(in) | :: | dist_l(:) | |||
| real, | intent(out) | :: | weight_l(:) |
Deallocate arrays in observation type
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_f), | intent(inout) | :: | thisobs |
Exclude observations for too high innovation
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(obs_l), | intent(inout) | :: | thisobs_l | |||
| type(obs_f), | intent(inout) | :: | thisobs | |||
| real, | intent(in) | :: | inno_l(:) | |||
| real, | intent(in) | :: | obs_l_all(:) | |||
| integer, | intent(in) | :: | obsid | |||
| integer, | intent(inout) | :: | cnt_all | |||
| integer, | intent(in) | :: | verbose |
Get statistics on local observations
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | screen |