This repository contains several R scripts to reclassify and compare connectivity maps (obtained with PinchPoint Mapper) as proposed in [1]. The workflow takes as input a set of rasters (same extend and resolution) that represents the connectivity map of several species. First, the rasters are reclassified in six levels of connectivity using the Loubar method [2] as described in [3]. We then build for each pair of reclassified rasters a matrix where each element represents the number of shared pixels between the different levels of connectivity. We finally compute a metric of similarity [3] between connectivity maps, defined as the tri-diagonal trace of the matrix defined above.
main.R reclassify the rasters contained in the folder Input_rasters, outputs from PinchPoint Mapper, in six levels of connectivity, where level 0 equals to habitat patches and levels 1, 2, 3, 4 and 5 stand for corridor levels, from high to low connectivity potential (values of 6 and 7 respectively represented areas with no connectivity or outside the calculation area of Pinchpoint mapper). The five corridor levels are determine with the functions thot() and hthot() contained in classify.R. The threshold for defining levels using a non-parametric method based on the derivative of the Lorenz curve [2]. The reclassify rasters are then exported in the folder Output_rasters. We then compute a confusion matrix between each pair of reclassified rasters. This squared matrix contained 7 rows and 7 columns corresponding to the different levels of connectivity 0 (patches), 1 to 5 (corridor levels) and 6 (no connectivity). Each element of the matrix represents the number of pixels in common for different couple of levels between two raster maps. The function phi() contained in phi.R take as input this confusion matrix to compute the similarity between maps defined as the ratio between the sum of the tri-diagonal trace of a matrix and the sum of the matrix [3].
[1] Louail et al. (2014) From mobile phone data to the spatial structure of cities. Scientific reports 4, 5276.
[2] Bassolas et al. (2019) Hierarchical organization of urban mobility and its connection with city livability. Nature communications 10, 4817.
[3] Préau et al. (2022) Dispersal-based species pools as sources of connectivity area mismatches. Landscape Ecology 37, 729-743. [arXiv]
If you use this code, please cite the following reference:
Préau et al. (2022) Dispersal-based species pools as sources of connectivity area mismatches. Landscape Ecology 37, 729-743. [arXiv]
If you need help, find a bug, want to give me advice or feedback, please contact me!
This repository is mirrored on both GitLab and GitHub. You can access it via the following links:
- GitLab: https://gitlab.com/maximelenormand/mismatch-connectivity
- GitHub: https://github.com/maximelenormand/mismatch-connectivity
The repository is archived in Software Heritage: