bioXgeo / geodiv

Other
11 stars 2 forks source link

sdq calculation using texture_image() returning zeros #13

Open ericlmcgregor opened 9 months ago

ericlmcgregor commented 9 months ago

I'm trying to calculate sdq using a moving window with texture_image() and it's returning a raster containing all zeros. I thought it may be something idiosyncratic to my dataset but it also seems to be doing it with the normforest data. See example. Other metrics seem to work. Any ideas?

`# import raster image data(normforest) normforest <- terra::unwrap(normforest)

crop raster to smaller area

x <- terra::crop(normforest, terra::ext(normforest[1:100, 1:100, drop = FALSE]))

Calculate sdq

sdq_img <- texture_image(x = x, window = 'square', size = 5, metric = 'sdq', parallel = TRUE, ncores = 1, nclumps = 20) sdq_img

plot the result

terra::plot(sdq_img)`

AnnieCooper commented 5 months ago

Thank you for bringing this to my attention. I'm going to work on updates in the next couple of weeks and will update you when it's fixed.