Search code examples
google-earth-engine

How to estimate a focal sum


hope your are fine! I am trying to estimate a kernel circle with a focal function summing the raster values, but just found hat there is no image.focal_sum() as I expected. Instead I found the focal_*: max, min, mean, median and mode, estimates. Is there a reason for not having te sum function? How would be possible to get this estimate? Thanks in advance.


Solution

  • You could use the "image.reduceNeighborhood()" option, see here (https://developers.google.com/earth-engine/reducers_reduce_neighborhood)

    // Compute sum over round kernel
    var result = imgage.reduceNeighborhood({
      reducer: ee.Reducer.sum(),
      kernel: ee.Kernel.circle(7),
    });