I have to count all the values in a matrix (2-d array) that are greater than 200.
The code I wrote down for this is:
za=0 p31 = numpy.asarray(o31)
This is very straightforward with boolean arrays:
p31 = numpy.asarray(o31) za = (p31 < 200).sum() # p31<200 is a boolean array, so `sum` counts the number of True elements