Merge with mean


Hey Guys,

I am trying to use rasterio.merge.merge to merge ~15 Datasets. This is working with the standard methods, but I want to calculate the mean of the datasets for each pixel.


Currently I am trying to use the following function:
def nanmean(old_data, new_data, old_nodata = -10000, new_nodata=-10000, index=None, roff=None, coff=None):
    old_data[:] = np.nanmean([old_data, new_data], axis = 0)

It seems (my output) that the mean calculation is not ignoring the no data values. I also tried to use np.where to set NaN's where the -10000 is in both datasets.

Any help would be great!