I have an undefined number of multi-layer rasters (TIFF files with 10
bands), and I need to find the maximum (or median, etc.) among the rasters.
The calculations should operate band by band, so the expected output is one
stack also with 10 bands.
# do.call works for undefined stacks, but not in parallel
As for parallel processing, I thought of clusteR, but it accepts only one
The problem is that for running overlay with multi-layer rasters, they
cannot be stacked, because if stacked, the function will apply to all bands
and hence output a single band, while in this case the function should
apply band by band.
An alternative to this, is to split the bands of all images, process the
bands individually in parallel inside a loop (i.e. band 1 of all images,
band 2 of all images, etc.),
and then combine the outputs in a multi-layer raster. However, this is
inefficient, specially with large rasters not hold in memory.