King Andy King Andy - 2 years ago 75
Python Question

Finding the element in one array corresponding to the maximum value in another

How can I align the 4d z array and the 4d QCLOUD array and to then find out the z value of when QCLOUD max occurs?

out: (6, 100, 128, 128)
(6, 99, 128, 128)

Answer Source

Ignoring the fact that (np.array(z.shape) > np.array(qcloud.shape)).any(), you want argmax:

idx = np.argmax(qcloud)
result = z[tuple(idx)]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download