Matt Knox wrote:
> all I can come up with is dumb brute force methods by iterating through all
> the values. Anyone got any tricks I can use?
import numpy as np
def first_masked(m):
idx = np.where(m.mask)[0]
if len(idx) != 0:
return idx[0]
else:
raise ValueError("no masked data")
first_unmasked() is left as an exercise for the reader.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion