I'm looking for the numpy-way to compare two 3-D arrays and return a new 3-D array containing the element-wise maxima based on a given index of the array. Here my value is in [y][x][7] for instance:
output = numpy.zeros((16, 16, 8))
# we want to compare the values in [y,x,7] and only keep the element with max value
for x in range(array_min.shape[1]):
for y in range(array_min.shape[0]):
if abs(array_min[y][x][7]) > array_max[y][x][7]:
output[y][x] = array_min[y][x]
else:
output[y][x] = array_max[y][x]