Skip to content

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

Description

@BlueGrisGris

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions