## DESCRIPTION

r.li.patchdensity is a patch index for r.li suite. It calculates the function:

    f(sample_area) = (Patch_Number/Area) * 1000000

that is 1000000 by number of patch for area unit. This index is calculated using a 4 neighbour algorithm.

## EXAMPLES

To calculate patch density index on map my_map, using my_conf configuration file (previously defined with r.li.setup) and saving results in the raster map my_out, run:

    r.li.patchdensity map=my_map conf=my_conf out=my_out

Example for Spearfish forest areas:

    g.region rast=landcover.30m -p
    # extract forested areas:
    r.category landcover.30m
    r.mapcalc "forests=if(landcover.30m >= 41 && landcover.30m <=43,1,null())"

    # patch density (7x7 moving window defined in r.li.setup):
    r.li.patchdensity forests conf=movwindow7 out=forests_p_dens7
    d.rast.leg forests_p_dens7

    r.to.vect forests out=forests feature=area
    d.vect forests type=boundary

## NOTES

A map of NULL values is considered to have zero patches.
If you want to have null values instead run

    r.null setnull=0 map=my_out

after index calculation.
If raster area is 0, r.li.patchdensity returns -1. This is only possible if the raster is masked.

## SEE ALSO

r.li package overview
r.li.daemon
r.li.setup

## AUTHORS

Claudio Porta and Lucio Davide Spano, students of Computer Science University of Pisa (Italy).
Commission from Faunalia Pontedera (PI) (www.faunalia.it)

Last changed: $Date: 2011-08-16 02:13:05 -0700 (Tue, 16 Aug 2011) $