I have two 3d numpy arrays a1 and a2 where len(a1) == len(a2) and a1[x, y, z] = id
I'm using this code to find out if there is changed data in any of the z layers
eq = a1 == a2
if eq.any():
#find the indexes of the changed data
as the comment and title says I need to find the indexes of the changed data. basically I have a list of objects that correspond the the positions in the array and I need to update those objects based on the id pulled form the array. I want to do this as fast as possible as this list can get REALLY large possibly more than 120,000 entries. but only a hundred or so of these entries are likely to change at any one time. as such I'd like to obtain a list of the changed indexes so I can call the object at that index and update it.
I do need to maintain the three components of the index
is there a way to do this without looping through the list? perhaps with numpy.nonzero()