Bug in new CCL
Closed this issue · 5 comments
There seems to be a problem with the following example and the new CCL, @bitbacchus. It seems that the large patch on the left-hand side gets separated into several patches (see the "rainbow colour" of the IDs).
library(raster)
#> Loading required package: sp
library(landscapemetrics)
nlcd <- raster::raster("~/Downloads/nlcd.tif")
show_patches(nlcd, directions = 8,
class = 42, labels = FALSE)
# used to be 222
max(raster::values(get_patches(nlcd, class = 42)[[1]]), na.rm = TRUE)
#> [1] 747
Created on 2020-01-03 by the reprex package (v0.3.0)
Actually, also augusta_nlcd
looks odd to me. I'm quite sure we did compare the algorithms for augusta_nlcd
, didn't we?
library(landscapemetrics)
show_patches(augusta_nlcd, class = 42, labels = FALSE)
Would it be possible that the error is related only to the colors, not the underlining code?
library(landscapemetrics)
show_patches(augusta_nlcd, class = "all", labels = FALSE)
Created on 2020-01-03 by the reprex package (v0.3.0)
@mhesselbarth I'll have a look tonight.
@Nowosad unfortunately, it seems the problem is in the rcpp code...
I don’t think so. The first example is from some teaching material I prepared some time ago. There used to be 222 patches in class 42 and now there are 747.
I looked into the code and I think I must have mixed up a row for a column somewhere. I can't spot it at a first glance, however. But I'm confident to fix this in the next couple of days. Until then, this is broken, however :-(