Skip to content

r.pi.enn

Analysis of n-th Euclidean Nearest Neighbor distance.

r.pi.enn [-a] input=name output=name keyval=integer method=string [,string,...] number=num[-num] [,num[-num],...] statmethod=string [dmout=string] [adj_matrix=string] [title="phrase"] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r.pi.enn input=name output=name keyval=integer method=string number=num[-num] statmethod=string

grass.script.run_command("r.pi.enn", input, output, keyval, method, number, statmethod, dmout=None, adj_matrix=None, title=None, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r.pi.enn", input="name", output="name", keyval=integer, method="string", number="num[-num]", statmethod="string")

Parameters

input=name [required]
    Name of input raster map
output=name [required]
    Name for output raster map
keyval=integer [required]
    Key value
method=string [,string,...] [required]
    Operation to perform on fragments
    Allowed values: distance, path_distance, area, perimeter, shapeindex
number=num[-num] [,num[-num],...] [required]
    Number of nearest neighbors to analyse
statmethod=string [required]
    Statistical method to perform on the values
    Allowed values: average, variance, standard deviation, value, sum
dmout=string
    Output name for distance matrix and id-map (performed if not empty)
adj_matrix=string
    Output name for adjacency matrix (performed if not empty)
title="phrase"
    Title for resultant raster map
-a
    Set for 8 cell-neighbors. 4 cell-neighbors are default
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

input : str, required
    Name of input raster map
    Used as: input, raster, name
output : str, required
    Name for output raster map
    Used as: output, raster, name
keyval : int, required
    Key value
method : str | list[str], required
    Operation to perform on fragments
    Allowed values: distance, path_distance, area, perimeter, shapeindex
number : str | list[str], required
    Number of nearest neighbors to analyse
    Used as: num[-num]
statmethod : str, required
    Statistical method to perform on the values
    Allowed values: average, variance, standard deviation, value, sum
dmout : str, optional
    Output name for distance matrix and id-map (performed if not empty)
    Used as: output, raster
adj_matrix : str, optional
    Output name for adjacency matrix (performed if not empty)
    Used as: output, raster
title : str, optional
    Title for resultant raster map
    Used as: "phrase"
flags : str, optional
    Allowed values: a
    a
        Set for 8 cell-neighbors. 4 cell-neighbors are default
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

r.pi.enn computes the euclidean distance between patches (1-n NN). Analysis of n-th euclidean nearest neighbour distance.

NOTES

The user must specify the names of the raster map layers to be used for input and output, the keyval the method (e.g. distance, area) and statmethod used (i.e., average).

Within r.pi.enn the following setting have to be set:

keyval setting

The keyval operator determines which category value is taken for the Patch Index analysis.

Method setting

The method operators determine what measure is applied on the nth NN.

  • Distance
    The Average computes the average distance of the n NN.
  • Path distance
    The path_distance computes the actual distance to the n NN.
  • Area
    The area computes the area of the n NN.
  • Perimeter
    The perimeter computes the perimeter of the n NN.
  • SHAPE Index
    The shapeindex computes the SHAPE Index of the n NN.

Statmethod setting

The statmethod operators determine what statistic measure is applied on the nth NN.

  • Average
    The Average computes the average distance of the n NN.
  • Variance
    The Variance computes the variance of the distance of the n NN.
  • Std. Dev.
    The Std. Dev computes the std. dev. of the distance of the n NN.

Number

The keyval operator determines which or how many Nearest Neighbour are analysed. 1,2,5 will analyse the 1, 2 and 5th Nearest Neigbour. 1-10 will analyse the 1, 2, 3, ... 10th Nearest Neighbour. 0 will analyse all Nearest Neighbours.

Distancematrix

The dmout operator is optional and determines if a distance matrix is written (first NN only). 1,2,5 will analyse the 1, 2 and 5th Nearest Neigbour. 1-10 will analyse the 1, 2, 3, ... 10th Nearest Neighbour. 0 will analyse all Nearest Neighbours.

EXAMPLE

An example for the North Carolina sample dataset:

r.pi.enn input=landclass96 output=dist1.c5 keyval=5 method=distance number=1 statmethod=average
# -> gives a map of patches (all of category of 5) with the average distance to their first NN

r.pi.enn input=landclass96 output=dist10.c5 keyval=5 method=distance number=10 statmethod=average
# -> gives a map of patches (all of category of 5) with the average distance to their first-10th NN

r.pi.enn input=landclass96 output=dist1.5.10.c5 keyval=5 method=distance number=1,5,10 statmethod=average
# -> gives a map of patches (all of category of 5) with the average distance to their first, first-to-fifth and first-to-10th NN

r.pi.enn input=landclass96 output=dist10b.c5 keyval=5 method=path_distance number=10 statmethod=average
# -> gives a map of patches (all of category of 5) with the actual distance to the 10th NN

SEE ALSO

r.pi.index, r.fragment.dist, r.pi.enn, r.pi.enn.pr, r.fragment.neighbors, r.li

AUTHORS

Programming: Elshad Shirinov
Scientific concept: Dr. Martin Wegmann
Department of Remote Sensing
Remote Sensing and Biodiversity Unit
University of Wuerzburg, Germany

Port to GRASS GIS 7: Markus Metz

SOURCE CODE

Available at: r.pi.enn source code (history)
Latest change: Friday Feb 21 12:27:42 2025 in commit 8fce680