OK so the problem is that `v is False` will return `False` because `v` is an array. You need to swap the lambda function for `np.logical_not` probably.

This will not handle masked arrays with singleton masks (`mask = ma.nomask`) but then neither will the existing code so not something to worry about here.