0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_spatialsimilarity::pd Interface Reference

Calculates pattern dissimilarity (PD) measure. More...

Public Member Functions

real(sp) function pd_sp (mat1, mat2, mask, valid)
 
real(dp) function pd_dp (mat1, mat2, mask, valid)
 

Detailed Description

Calculates pattern dissimilarity (PD) measure.

PD = 1 - sum(dissimilarity(mat1, mat2)) / count(mask) dissimilarity(mat1, mat2) = comparison if pixel is larger than its neighbouring values

An array element value is compared with its 8 neighbouring cells to check if these cells are larger than the array element value. The result is a 3x3 matrix in which larger cells are indicated by a true value. For comparison this is done with both input arrays. The resulting array is the sum of xor values of the 3x3 matrices for each of the both arrays. This means only neighbourhood comparisons which are different in the 2 matrices are counted. This resulting matrix is afterwards normalized to its available neighbors. Furthermore an average over the entire field is calculated. The valid interval of the values for PD is [0..1]. In which 1 indicates full agreement and 0 full dismatching.

            EXAMPLE:
mat1 = | 12 17 1 | , mat2 = | 7 9 12 | | 4 10 11 | | 12 11 11 | | 15 2 20 | | 5 13 7 | booleans determined for every grid cell following fortran array scrolling i.e. (/col1_row1, col1_row2, col1_row3, col2_row1, .. ,col3_row3/),(/3,3/) comp1 = | FFF FFF FTF, FFF FFF FFF, FTT FFT FFF | | FFF TFT TTF, TFT TFF FTT, TFF FFT FFF | | FFF FFF FFF, TTF TFF TTF, FFF FFF FFF | comp2 = | FFF FFT FTT, FFT FFT FTT, FFF FFF FFF | | FFF FFF FFT, FTF FFT TFF, FFT TFF FFF | | FFF TFF TTF, FFF FFF FFF, TTF TFF FFF | xor=neq = | FFF FFT FFT, FFT FFT FTT, FTT FFT FFF | | FFF TFT TTT, TTT TFT TTT, TFT TFT FFF | | FFF TFF TTF, TTF TFF TTF, TTF TFF FFF | DISSIMILAR / VALID NEIGH CELLS PDMatrix = | 2, 4, 3 | / | 3, 5, 3 | = | 0.66, 0.80, 1.00 | | 5, 8, 4 | | 5, 8, 5 | | 1.00, 1.00, 0.80 | | 3, 5, 3 | | 3, 5, 3 | | 1.00, 1.00, 1.00 | PD = 1 - sum(PDMatrix) / count(mask) = 1 - (8.2666666 / 9) = 0.08148

If an optinal mask is given, the calculations are over those locations that correspond to true values in the mask. mat1 and mat2 can be single or double precision. The result will have the same numerical precision.

Parameters
[in]real(sp/dp), dimension(:,:) :: mat12D-array with input numbers
[in]real(sp/dp), dimension(:,:) :: mat22D-array with input numbers
[in]logical,dimension(:,:),optinal :: mask2D-array of logical values with size(mat1/mat2) If present, only those locations in mat1/mat2 having true values in mask are evaluated.
[out]logical,optinal :: validindicates if the function could determine a valid value result can be unvalid if entire mask is .false. for ex. in this case PD is set to 0 (worst case)
Returns
real(sp/dp) :: PD — pattern dissimilarity measure
Author
Matthias Zink and Juliane Mai
Date
Jan 2013

Definition at line 218 of file mo_spatialsimilarity.f90.

Member Function/Subroutine Documentation

◆ pd_dp()

real(dp) function mo_spatialsimilarity::pd::pd_dp ( real(dp), dimension(:, :), intent(in)  mat1,
real(dp), dimension(:, :), intent(in)  mat2,
logical, dimension(:, :), intent(in), optional  mask,
logical, intent(out), optional  valid 
)

Definition at line 491 of file mo_spatialsimilarity.f90.

◆ pd_sp()

real(sp) function mo_spatialsimilarity::pd::pd_sp ( real(sp), dimension(:, :), intent(in)  mat1,
real(sp), dimension(:, :), intent(in)  mat2,
logical, dimension(:, :), intent(in), optional  mask,
logical, intent(out), optional  valid 
)

Definition at line 400 of file mo_spatialsimilarity.f90.


The documentation for this interface was generated from the following file: