Closed esc24 closed 10 years ago
Looks like this needs a little extra work as
a = biggus.NumpyArrayAdapter(np.arange(12).reshape(3,4))[:, :]
a[np.array([True, False, True])]
gives an unexpected answer.
Just checking you know about:
>>> import numpy as np
>>> a = np.arange(12)
>>> a[np.zeros(12, dtype=np.bool)]
array([], dtype=int64)
>>> a[np.zeros(10, dtype=np.bool)]
array([], dtype=int64)
>>> a[np.ones(10, dtype=np.bool)]
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
Thanks @pelson. I'd missed that. I've relaxed the restriction so the key is effectively zero padded if it is short. Overall, that was more complicated than I'd expected, but I've learnt something.
:+1: - I would merge. My only hesitation would be to test the actual index values, not just the shapes.
I'll give this a couple of days before merging.
the key is effectively zero padded if it is short
This behaviour might have changed in NumPy 1.9.
This PR adds [boolean indexing].
Super! :smile:
Biggus is used in Iris. Before the switch to use Biggus one could used boolean indexing on cubes (see https://github.com/SciTools/iris/pull/643). Biggus does not currently support this ability e.g.
This should be
This PR adds this functionality.