I have extracted the mean of some of the new SoilGrid soil properties, for my region of interest from GEE (See here for more details) (the "Latest" vs "Snapshot" data). This data is for 0-15cm, 5-15cm and 15-30cm of the soil depths when compared to the old SoilGrids data which provided only one value for 0-30cm. See here for more information.

How do I combine the rasters of the 3 soil depths, say for sand fraction which is defined as "Proportion of sand particles (> 0.05 mm) in the fine earth fraction in g/kg (mapped units)" (as per the second link above), to get one raster representing the soil fraction in 0-30cm depth?

If I should do a weighted average, what weights do I provide? Is this a decision based on my research question? Or can I do a simple mean of all 3 rasters?

All processing is being done in R.

  • The three rasters seem to have overlapping depth (0 to 15 and 5 to 15) so a simple mean would be biased by the 5 to 15 range being included twice. What variables are in the raster? Do you have sand fraction in the raster at each of those depth ranges? Or is it total soil and total sand? Or did you mean (0 to 5) in the first raster?
    – Spacedman
    Commented Mar 18, 2021 at 17:08
  • @Spacedman- edited the question to hopefully answer your questions in your comment
    – tg110
    Commented Mar 18, 2021 at 17:30

1 Answer 1


I don't think you can do this with only the sand fraction of the fine earth fraction.

Suppose the sand fraction is 0.1 in the first layer and 0.5 in the second.

A simple average would return a sand fraction of 0.3.

But suppose the fine earth fraction is 5 g/kg in the first and 2 g/kg in the second. In a kg of soil in the first layer, 5g is fine earth, and 0.1 of that 5g of fine earth (=0.5g) is therefore sand. For the second layer, in a kilo of soil 2g is fine soil, and 0.5 of that 2g (=1g) is sand. That gives a total of 1.5 g of sand in a total of 7 g of fine earth in those 2kg of soil, giving a proportion of sand as 1.5/7 which is 0.2143 - which is not 0.3.

If you have the fine earth fraction as well then you can compute it, its a weighted average of the sand proportion (weighted in some way by the fine earth fraction). Otherwise I don't think you can, unless you assume the fine earth fraction is constant with depth, and then you can take a simple average.

I doubt you should use the overlapping depths raster for the calculation - use only the non-overlapping ones unless the overlapping one comes from an independent model, otherwise you will bias your result by including the same data twice.

To see how to do the weighted sum in R, lets set up the data like in my example and see what happens. If we can make it work for those numbers then it should be general enough for anything.

Empty rasters:

> sand1 = raster()
> sand2 = raster()
> fine1 = raster()
> fine2 = raster()

Fill them with values:

> sand1[]=0.1
> sand2[]=0.5
> fine1[] = 5
> fine2[] = 2

weighted mean is sum of weighted values divided by sum of weights:

> sandmean = (sand1 * fine1 + sand2 * fine2) / (fine1 + fine2)

and every value should now be:

> sandmean[1]
[1] 0.2142857
> sandmean[342]
[1] 0.2142857


  • There is bulk density of fine earth available at the different depths too, which I can use to weight the sand fraction rasters to get the weighted average
    – tg110
    Commented Mar 19, 2021 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.