I'm trying to calculate the weighted centroid of some raster layers I have, which are basically patches of positive values in a sea of null values.
I know I could convert thoses patches to binary data (1 inside a patch, null outside), vectorize them, calculate the centroid of each patch and then the "centroid of the centroids". But I really need to keep a coefficient corresponding to the value of each pixel in the original raster layer (I want that the core of each patch with higher values influence the location of the centroid).
It is not a problem in my case that the centroid will be outside existing patches, but I simply don't know how to perform this calculation from the raster layer using GRASS. Does any one know how to to this?