Bug in lsm_p_circle
Closed this issue · 2 comments
mhesselbarth commented
Haha...me again :D
This time (I'm almost sure) I really found a bug in lsm_p_circle() if the whole landscape is just one patch.
library(raster)
#> Loading required package: sp
library(landscapemetrics)
mat <- matrix(data = 1, ncol = 100, nrow = 100)
input_lsm <- raster::raster(mat,
xmn = 0, xmx = 100,
ymn = 0, ymx = 100)
lsm_p_circle(input_lsm)
#> # A tibble: 0 x 6
#> # ... with 6 variables: layer <int>, level <chr>, class <int>, id <int>,
#> # metric <chr>, value <dbl>
Created on 2019-09-03 by the reprex package (v0.3.0)
mhesselbarth commented
The core of the problem seems to be in get_boundaries() for all cases where only one patch is present
mhesselbarth commented
Should be fixed: 6b09984 / e86f42a
library(raster)
#> Loading required package: sp
library(landscapemetrics)
mat <- matrix(data = 1, ncol = 100, nrow = 100)
input_lsm <- raster::raster(mat,
xmn = 0, xmx = 100,
ymn = 0, ymx = 100)
lsm_p_circle(input_lsm)
#> # A tibble: 1 x 6
#> layer level class id metric value
#> <int> <chr> <int> <int> <chr> <dbl>
#> 1 1 patch 1 1 circle 0.363
Created on 2019-09-03 by the reprex package (v0.3.0)