I have a 4 dimensional array, i.e., data.shape = (20,30,33,288). I am finding the index of the closest array to n using
data.shape = (20,30,33,288)
index = abs(data - n).a
If I understood you correctly, this should work:
numpy.put(data, index, values)
I learned something new today, thanks.