I am trying to use python's numpy.argwhere
to return the indexes of an array meeting various multiple conditions.
I am having an issue implementing &
as well as or
into the multiple conditions.
for example x y and z are arrays with the same length that represent simultaneous time series of different variables.
np.argwhere((x>2) & (y=0) & (z>-1) & (z<1)).squeeze()
is simple and works
but I can't get it to work to find where z<-1
or z>1
along with the other conditions met as well.
I keep getting
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
after many logical ways of using parenthesis.