Numpy mask for 3D array
How to use np.where and mask on a 3D array? If I use normal operation, I received an error like this:
An easy way to fix this is to operate slice by slice:
pShape = sandpct.shapea Data_out= np.full(pShape, 0, dtype=float) for i in np.arange(0, pShape[0], 1): aData_out[i][aMask==1] += 5
aData_out[aData_out>100] = 100 pDatasets_in.close()