I have an array Gamma, Gamma.shape=(20,7,90,144), that represents the dimensions (t,z,y,x) and whose respective indices I denote by [l,k,j,i]. For each (t,y,x), I want to find the lowest value of k such that Gamma[l,k,j,i] > g_crit, where g_crit is some constant. Denote this set of lowest k values as k_low; I've found I can do this nicely with
k_low = np.argmax(Gamma > g_crit, axis=1)
There is another array levs, levs.shape=(7,), corresponding to the z dimension as well. I am ultimately trying to create the array levs_low, such that levs_low.shape=(20,90,144) and levs_low[l,j,i]=levs[k_low[l,j,i]]. I'm stuck on this step. Any ideas please? Thanks.