I have many 100×100 grids, is there an efficient way using numpy to calculate the median for every grid point and return just one 100×100 grid with the median values? Presently, I’m using a for loop to run through each grid point, calculating the median and then combining them into one grid at the end. I’m sure there’s a better way to do this using numpy. Any help would be appreciated! Thanks!
Share
Create as 100x100xN array (or stack together if that’s not possible) and use
np.medianwith the correct axis to do it in one go: