I have a few million 2D arrays with dimension 1400x1400. I currently calculate the local RMS within the 2D array using a box kernel of 100x100 that starts from the top left and moves 1 pixel at a time to calculate local RMS within the box. However, this takes up about 3 minutes per 2D array and is not computationally feasible. I was wondering if there is a faster way to do the same thing instead of the nested loop that I currently use. Below is my code
for row in range(1400):
for col in range(1400):
box = data[row:(row+100),col:(col+100)]
rms = np.nanstd(box)
noise_map[row:(row+100),col:(col+100)] = rms
Thanks