I'm still developing in my R/geospatial journey, but have hit a speed bump in trying to emulate/adapt a methodology I've come across in the literature.
Basically, I have two stacked rasters (A and B), and I'd like to pass a moving window over raster A that calculates the mean value within it, but only for those pixels that meet thresholds applied to raster B. If minimum criteria are not met in B, then I'd like to increase the size of the moving window until the criteria are met.
My initial guess would have been to look at raster::focal and a series of if/else statements within a function (?). But, I don't know how I would go about being able to change the size of the focal window.
I can't get my head around this one, and can only offer a short flowchart of the desired methodology IF you are able to offer any assistance.
Much appreciated
Aucun commentaire:
Enregistrer un commentaire