import numpy as np
mat_a = np.random.random((5, 5))
mat_b = np.random.random((5, 5))
mat_c = np.random.random((5, 5))
Lets say for a specific grid cell, the values in the same position in the 3 arrays are as follows:
mat_a, A = 0.3
mat_b, B = 0.2
mat_c, C = 0.1  
Here, we find the array with the least value, in this case it is C
- We compute the amount of - Cthat should be allocated to- Bas- 0.1 * (0.2/ (0.2 + 0.3))i.e. Value of cell in- Cmultiplied by the fraction of- Bwith- totalbeing- A + B. The newly computed value is stored in a- 2Darray called- C_B
- Similarly, the amount of - Cthat should be allocated to- Ais- 0.1 * (0.3/(0.2 + 0.3)). The newly computed value is stored in a- 2Darray called- C_A.
- We repeat this process for cells where least value is in array - B, storing the newly computed results in- 2Darrays- B_Cand- B_Arespectively.
- We repeat this process for cells where least value is in array - A, storing the newly computed results in- 2Darrays- A_Cand- A_Brespectively.
The only way I can think of doing this is using nested for loops, but that would be prohibitive for larger arrays and not very pythonic. Is there a fast and pythonic solution?
-- edit
C_B should contain 0 where mat_c does not contain smallest value 
C_Bjust contain zeros at all positions wheremat_cdid not contain the smallest value?A_C,A_B,B_CandB_Ato be zeros? It might also help if you point to what you are finally trying to accomplish with these arrays.C_Bshould contain 0 wheremat_cdoes not contain smallest value