r-spatialecology / landscapemetrics

Landscape Metrics for Categorical Map Patterns 🗺️ in R
https://r-spatialecology.github.io/landscapemetrics
GNU General Public License v3.0
230 stars 43 forks source link

Difference to new FRAGSTATS version #294

Closed mhesselbarth closed 1 year ago

mhesselbarth commented 1 year ago

I rerun the results using the latest FRAGSTATS version and created a test (helper-fragstats.R, test-fragstats.R). Most metrics are identical or within a certain threshold due to numerical differences (less than 5%). However, especially DCORE is really off and I don't know why yet. Especially since most other core metrics seem to be okay.

Also, there are a few differences of the CV or SD values on class level (more than 5% less than 10%) that I am not sure why.

mhesselbarth commented 1 year ago

Related to https://github.com/r-spatialecology/landscapemetrics/commit/28ca2360398b1f36a4a901f33dd36a5ebebc5e1c

There are a few metrics which have some deviations from FRAGSTATS which can not be explained by numeric differences. Mostly, they seem to be related to the core area and and the augusta landscape. But also other issues seem to be present.

Currently the test are commented out.

Patch level

Class level

landscape

Also, kind of related. Given we already test metrics on patch level, I don't compare the distribution of them on class and landscape level. If the patch-scale is identical, also mean, sd, and cv must be.

Nowosad commented 1 year ago

Maybe gyrate difference is explained here -- https://r-spatialecology.github.io/landscapemetrics/articles/comparing_tools.html

mhesselbarth commented 1 year ago

Fixed vignette 7b68e22a114f35e387c632d05c0d754f3eb68d66

mhesselbarth commented 1 year ago

I have a suspicion about all metrics related to the core. We define core as cells using "[...] has no neighbour with a different value than itself (rook's case) [...]". I think FRAGSTATS uses a distance definition where it seems core cells are all cells (or their center coordinate) further away from the edge than a certain threshold.

Edit: Yes, found it in the FRAGSTATS manual. They are using a distance-mask placed on the perimeter (Second paragraph)

Nowosad commented 1 year ago

@mhesselbarth see:

library(terra)
#> terra 1.7.46
landscape = terra::rast(landscapemetrics::landscape)
plot(landscape)

plot(t(flip(landscape, "horizontal")))

Created on 2023-09-27 with reprex v2.0.2

mhesselbarth commented 1 year ago

Thanks, but I start to doubt we can match the exact FRAGSTATS labelling. They are actually going zick-zack I think. Additionally, they are going by patch first and class second, where we go by class first and patch second...

mhesselbarth commented 1 year ago

All tests run with a correlation of p>= 0.975 on patch level and deviations of less than 5% on class and landscape level