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

Calculates the number of neighboring dominating values, a measure for spatial dissimilarity. More...

Public Member Functions

real(sp) function nndv_sp (mat1, mat2, mask, valid)
 
real(dp) function nndv_dp (mat1, mat2, mask, valid)
 

Detailed Description

Calculates the number of neighboring dominating values, a measure for spatial dissimilarity.

NNDV = 1 - sum(abs(dominating_neighbors(mat1) - dominating_neighbors(mat2))) / count(mask) dominating_neighbors(mat1) = 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 substraction of the 3x3 matrices for each of the both arrays. The 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 NNDV 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 | NNDVMatrix = abs( count(comp1) - count(comp2) ) = | 1-3, 0-4, 3-0 | = | 2, 4, 3 | | 4-1, 5-3, 2-2 | | 3, 2, 0 | | 0-3, 5-0, 0-3 | | 3, 5, 3 | DISSIMILAR / VALID NEIGH CELLS NNDVMatrix / VALID NEIGH CELLS = | 2, 4, 3 | / | 3, 5, 3 | | 3, 2, 0 | | 5, 8, 5 | | 3, 5, 3 | | 3, 5, 3 | = | 0.66, 0.80, 1.00 | | 0.60, 0.25, 0.00 | | 1.0, 1.00, 1.00 | NNDV = 1 - sum(NNDVMatrix) / count(mask) = 1 - (6.31666666 / 9) = 0.2981

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 :: validindicates if the function could determine a valid value result can be unvalid if entire mask is .false. for ex. in this case PatternDissim is set to 0 (worst case)
Returns
real(sp/dp) :: NNDV — Number of neighboring dominating values
Note
routine based on algorithm by Luis Samaniego 2009
Author
Matthias Zink
Date
Nov 2012

Definition at line 119 of file mo_spatialsimilarity.f90.

Member Function/Subroutine Documentation

◆ nndv_dp()

real(dp) function mo_spatialsimilarity::nndv::nndv_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 312 of file mo_spatialsimilarity.f90.

◆ nndv_sp()

real(sp) function mo_spatialsimilarity::nndv::nndv_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 226 of file mo_spatialsimilarity.f90.


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