Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example Code for texture_image() produces an empty raster #16

Open
BlueGrisGris opened this issue Apr 10, 2024 · 1 comment
Open

Example Code for texture_image() produces an empty raster #16

BlueGrisGris opened this issue Apr 10, 2024 · 1 comment

Comments

@BlueGrisGris
Copy link

Hello,
Just started looking into geodiv for my research. When I tried to run the example code for texture_image(), I get a raster filled with Inf. This also occurs when I apply the function to my own data.
Example:

> help(texture_image)
> 
>      # 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]))
>      
>      # get a surface of root mean square roughness
>      sa_img <- texture_image(x = x, window = 'square',
+      size = 5, metric = 'sa',
+      parallel = TRUE, ncores = 1, nclumps = 20)
[1] "Beginning calculation of metrics over windows..."
Total time to calculate metrics: 1.361829
>      
>      # plot the result
>      terra::plot(sa_img)
> sa_img
class       : SpatRaster 
dimensions  : 100, 100, 1  (nrow, ncol, nlyr)
resolution  : 0.0002694946, 0.0002694946  (x, y)
extent      : -123, -122.9731, 43.07305, 43.1  (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84 
source(s)   : memory
name        : summer_ndvi_p45_r30_2000_2016_30m 
min value   :                     1.797693e+308 
max value   :                               Inf 
> 

Thanks!

@biodiverCD-2
Copy link

I am having the same issue. It seems to occur with some surface metrics and not others.

@AnnieCooper @adammwilson @plzmsu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants