-
Notifications
You must be signed in to change notification settings - Fork 47
Description
The lsm_c_te() function includes a directions argument (either 4 or 8), which is expected to influence the Total Edge (TE) calculation by defining the neighborhood structure.
However, upon inspecting the source code, it appears that this argument is not passed to rcpp_get_coocurrence_matrix_single() within lsm_c_te_calc(). Instead, the value is hardcoded as 4, regardless of the user input.
(around line 135 in lsm_c_te.R)
neighbor_matrix <- rcpp_get_coocurrence_matrix_single(
landscape_labeled,
directions = as.matrix(4), # <- hardcoded
single_class = -999
)
As a result, specifying directions = 8 in lsm_c_te() seems to have no effect on the TE output, even though lsm_c_te() sets directions = 8 as the default. This may lead to a discrepancy between the expected behavior and the actual implementation.
The function should dynamically use the directions argument provided by the user, for example:
neighbor_matrix <- rcpp_get_coocurrence_matrix_single(
landscape_labeled,
directions = as.matrix(directions),
single_class = -999
)
This would ensure that TE and related metrics (such as Edge Density) accurately reflect the intended neighborhood configuration.
Question
It’s possible that I may be misunderstanding the intended behavior, but I wanted to ask:
- Is the hardcoded directions = 4 an intentional design decision?
- Or should the function reflect the directions argument passed to lsm_c_te()?
- I would appreciate any clarification on whether this is expected behavior or a potential oversight.
Thank you very much for your work on this excellent package!