landscapemetrics icon indicating copy to clipboard operation
landscapemetrics copied to clipboard

clumpy returns NA or >1

Open jamiemkass opened this issue 3 years ago • 6 comments

I have been experimenting with lsm_c_clumpy() and have noticed that when all cells are the same class it can return NA, and when there is a large majority of one class it can return values well above 1 (>5). Is this the expected behavior? The documentation says it should range between -1 and 1. Thanks.

jamiemkass avatar Apr 07 '21 05:04 jamiemkass

I think that the NA behavior is correct: "Note, CLUMPY is undefined and reported as N/A in the output files when the class consists either of a single cell, comprises all but 1 cell, or comprises the entire landscape, because it is impossible to distinguish between clumped, random and dispersed distributions in these cases." - http://www.umass.edu/landeco/research/fragstats/documents/Metrics/Contagion%20-%20Interspersion%20Metrics/Metrics/C115%20-%20CLUMPY.htm.

I am not sure about the above 1 cases... @mhesselbarth ?

Nowosad avatar Apr 07 '21 07:04 Nowosad

@jamiemkass Could you please provide a reproduce example for the clumpy > 1 result so I can look into it.

mhesselbarth avatar Apr 07 '21 12:04 mhesselbarth

I've saved the raster I was using as a RDS file because it had over a thousand values. Hopefully this example can help you get to the bottom of this. Thanks.

ras.rds.zip

ras <- readRDS("ras.rds") lsm_c_clumpy(ras)

jamiemkass avatar Apr 13 '21 03:04 jamiemkass

Okay...I need to do some more digging, but my first guess is we run into problems with the adjacencies due to the circular shape of the landscape

mhesselbarth avatar Apr 14 '21 12:04 mhesselbarth

I too am getting numbers beyond [-1,1], NA, and Inf results. The reasons for NA makes sense as stated above. The Inf came up with rasters where the proportion of landscape in the class was extremely low, so I think this might just be an underflow issue. The issue with negative numbers below -1 seem to be similar to the NA, they were all very small numbers (e.g., -255) and in situations where the landscapes only had 1-4 single cell patches. However, the values that are greater than 1 (largest value is 4.46) all seem to be in landscapes with varying number of patches that are >1 cells. For me this is not necessarily associated with scenario where a large majority of prop of landscape is covered by the class as stated above. However, they do seem to be associated to landscapes that also get a fairly high AI (50-100).

TravisGallo avatar Jun 22 '21 12:06 TravisGallo

I got another mail about this, so probably should really look into this...

mhesselbarth avatar Jan 20 '22 21:01 mhesselbarth

Hi Was there ever resolution of this issue? I am also getting values >1 and the fact that the index is positively correlated with the amount of the class I'm interested in suggests the calculation is not working. This index is really useful for understanding landscape pattern for wildlife and so I was hoping to keep it. Results I get suggest I need to ignore it and use other aggregation metrics. Thanks Aaron

ADFlesch avatar Jan 21 '23 22:01 ADFlesch

Could you also provide an example dataset where this happens? This would help us to track down where issues arise.

mhesselbarth avatar Jan 24 '23 10:01 mhesselbarth

Any resolution for this issue? I have the same problem with values mostly varying between zero and 10.

ex_clump.rds.zip for_b <- read_rds(file = "ex_clump.rds") lsm_c_clumpy(for_b)

Thx!

br-amaral avatar Jul 10 '23 21:07 br-amaral

Hi Bruna

I think I had the landscape window set too narrowly (too few pixels) to get reasonable metrics and that was the issues

regards Aaron


From: Bruna Amaral @.> Sent: Monday, July 10, 2023 2:00 PM To: r-spatialecology/landscapemetrics @.> Cc: Flesch, Aaron D - (flesch) @.>; Comment @.> Subject: [EXT]Re: [r-spatialecology/landscapemetrics] clumpy returns NA or >1 (#232)

External Email

Any resolution for this issue? I have the same problem with values mostly varying between zero and 10.

ex_clump.rds.ziphttps://github.com/r-spatialecology/landscapemetrics/files/12008492/ex_clump.rds.zip for_b <- read_rds(file = "ex_clump.rds") lsm_c_clumpy(for_b)

Thx!

— Reply to this email directly, view it on GitHubhttps://github.com/r-spatialecology/landscapemetrics/issues/232#issuecomment-1629725168, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5MQORQTHCCEQQBSHZZ54Q3XPRUPZANCNFSM42QBV6LQ. You are receiving this because you commented.Message ID: @.***>

ADFlesch avatar Jul 10 '23 21:07 ADFlesch

So can this be closed or is there still an issue?

mhesselbarth avatar Jul 11 '23 13:07 mhesselbarth

Pretty sure it just needs a comment related to selecting an appropriate window size. Did not test the threshold but its likely >50 pixels Aa


From: Maximilian Hesselbarth @.> Sent: Tuesday, July 11, 2023 6:05 AM To: r-spatialecology/landscapemetrics @.> Cc: Flesch, Aaron D - (flesch) @.>; Comment @.> Subject: [EXT]Re: [r-spatialecology/landscapemetrics] clumpy returns NA or >1 (#232)

External Email

So can this be closed or is there still an issue?

— Reply to this email directly, view it on GitHubhttps://github.com/r-spatialecology/landscapemetrics/issues/232#issuecomment-1630794614, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5MQORVF2NCLMLAH634LGJ3XPVFSJANCNFSM42QBV6LQ. You are receiving this because you commented.Message ID: @.***>

ADFlesch avatar Jul 12 '23 15:07 ADFlesch

Thanks, Aaron.

I'm trying to compare landscape metrics across different spatial extents so it is helpful to know 50ish pixels will be a lower limit. Do you by any chance know if this 50px window size is a 'rule' for most functions in Fragstats?

Bruna

br-amaral avatar Jul 12 '23 16:07 br-amaral

50 pixels is just my guess but makes sense based on basic sampling theory. the error came with just ~15 in my case.


From: Bruna Amaral @.> Sent: Wednesday, July 12, 2023 9:04 AM To: r-spatialecology/landscapemetrics @.> Cc: Flesch, Aaron D - (flesch) @.>; Comment @.> Subject: [EXT]Re: [r-spatialecology/landscapemetrics] clumpy returns NA or >1 (#232)

External Email

Thanks, Aaron.

I'm trying to compare landscape metrics across different spatial extents so it is helpful to know 50ish pixels will be a lower limit. Do you by any chance know if this 50px window size is a 'rule' for most functions in Fragstats?

Bruna

— Reply to this email directly, view it on GitHubhttps://github.com/r-spatialecology/landscapemetrics/issues/232#issuecomment-1632813380, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A5MQORXTWB6PKLPY5NZVRCLXP3DJHANCNFSM42QBV6LQ. You are receiving this because you commented.Message ID: @.***>

ADFlesch avatar Jul 12 '23 16:07 ADFlesch

It's probably hard to come up with a threshold given that it will be highly depending on the composition and configuration of the landscape

mhesselbarth avatar Jul 13 '23 07:07 mhesselbarth

@mhesselbarth close?

Nowosad avatar Sep 25 '23 08:09 Nowosad

543f6d7

Should be fixed for now...

mhesselbarth avatar Sep 29 '23 13:09 mhesselbarth