When I do running / rolling mean with weights in numpy, I e.g. do something like this:
data = np.random.random(100) # Example data... weights = np.array([1,
This is specific for the [1,2,1] weights, and it requires two steps, so it is not the best solution, but it is quite quick:
dim_name = "dim_0" da_mean = da.rolling(**{dim_name: 3, "center": True}).mean(dim=dim_name) da_mean = (3 * da_mean + da) / 4. # Expand it, and add the middle value.