tried this with a sample 6x6 grid. i´d really like to know if there´s a better way (i´m sure there is) using more numpy/scipy (tried that at first but couldn´t really get it working).anyways...in:
[[ 5.4 7.5 2.2 8.5 8.6 7.5]
[ 7.7 3.5 1.4 9.6 8.5 5.5]
[ 5.2 6.1 8.6 6.7 4.3 6.8]
[ 9.3 4.5 2.7 3.6 6.7 4.5]
[ 1.2 2.3 7.2 6.3 2.2 2. ]
[ 1.3 2. -99. 4. -99. 1.2]]
nrows=6
ncols=6
for row in range(0, nrows -1, 1):
for col in range(0, ncols -1, 1):
# current 2x2 subgrid
curgrid = {grid[row,col]:(row,col), grid[row, col+1]:(row, col+1),\
grid[row+1,col]:(row+1,col), grid[row+1, col+1]:(row+1, col+1)}
# set max of current subgrid in the totalgrid to 0
grid[curgrid[max(curgrid)]] = 0
out:
[[ 5.4 0. 2.2 8.5 0. 7.5]
[ 0. 3.5 1.4 0. 0. 5.5]
[ 5.2 0. 0. 0. 0. 0. ]
[ 0. 0. 2.7 0. 0. 0. ]
[ 1.2 0. 0. 0. 0. 0. ]
[ 1.3 0. -99. 0. -99. 0. ]]