This is always creating `np.ones_like(array)`, which could be very large, even when explicit weights are supplied or no weighting is required. Similarly, `wsum` is always multiplied by the weights even when no weighting is required.