Skip to contents

It allows to transform and aggregate SoilGrids rasters. I.e. from SoilGrids one would download several layers (0-5, 5-15, 15-30, etc.). This function will take an average among them and convert to conventional units (see SoilGrids FAQ)

Usage

aggregate_soilgrids(r)

Arguments

r

SpatRaster, single/multiple layer with soil characteristics. Outcome of the get_soilgrids() function.

Value

SpatRaster

Examples

library(purrr)

f <- system.file("extdata/extent.shp", package="rusleR")
v <- vect(f)

sand <- get_soilgrids(v, layer = "sand")
#> Downloading Sand rasters...
sand
#> class       : SpatRaster 
#> dimensions  : 10, 8, 3  (nrow, ncol, nlyr)
#> resolution  : 239.5216, 239.5216  (x, y)
#> extent      : 337313, 339229.2, 4814440, 4816835  (xmin, xmax, ymin, ymax)
#> coord. ref. : +proj=utm +zone=38 +datum=WGS84 +units=m +no_defs 
#> source      : memory 
#> names       : sand_0-5cm_mean, sand_5-15cm_mean, sand_15-30cm_mean 
#> min values  :        286.0000,              293,          288.0000 
#> max values  :        314.8233,              319,          318.8233 

sand_agg <- aggregate_soilgrids(sand)
sand_agg
#> class       : SpatRaster 
#> dimensions  : 10, 8, 1  (nrow, ncol, nlyr)
#> resolution  : 239.5216, 239.5216  (x, y)
#> extent      : 337313, 339229.2, 4814440, 4816835  (xmin, xmax, ymin, ymax)
#> coord. ref. : +proj=utm +zone=38 +datum=WGS84 +units=m +no_defs 
#> source      : memory 
#> name        :     sand 
#> min value   : 28.90000 
#> max value   : 31.70977