bcolz icon indicating copy to clipboard operation
bcolz copied to clipboard

`wheretrue()` for multidimensional carray

Open 87 opened this issue 13 years ago • 4 comments

Does not work completely:

In [23]: c = ca.carray([True]*9).reshape((3,3))
In [24]: c[1,2] = False
In [26]: list(c.wheretrue())
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/usr/local/lib/python2.6/dist-packages/carray/carrayExtension.so in carray.carrayExtension.carray.wheretrue (carray/carrayExtension.c:12949)()

ValueError: `self` is not an array of booleans

87 avatar Mar 30 '11 16:03 87

Yep, the wheretrue() method is only valid for unidimensional arrays. This has been documented now (rev 5b949bf). Not closing as a remind for a possible implementation in the future.

FrancescAlted avatar Aug 20 '12 09:08 FrancescAlted

I've just run across this problem. It's very unfortunate.

I have a ctable with one column called 'time_stamp_nanos' and a two other columns that have multidimensional data in them. If I use a blaze expression, I can successfully select a subset of the rows.

However, if I use 'fetchwhere' directly I get the problem mentioned above. That must mean that the blaze binding for bcolz doesn't use 'fetchwhere'.

How hard would it be to fix this problem? I'm willing to have a go if I can get some pointers.

Anders.

andersglindstrom avatar Sep 14 '16 13:09 andersglindstrom

Hi Anders. In case you want to give this a go, I'd start with adding a new query mode (similar to wheretrue_mode), and then implementing multidimensional queries in the __next__ method of the ctable iterator. Good luck!

FrancescAlted avatar Sep 15 '16 08:09 FrancescAlted

Hi Francesc,

thanks for the pointers. I'd really like to give it a go but I'm pretty tight for time. But then again, who isn't? :-)

Anders.

On 15/09/16 18:54, FrancescAlted wrote:

Hi Anders. In case you want to give this a go, I'd start with adding a new query mode (similar to wheretrue_mode https://github.com/Blosc/bcolz/blob/5b949bfab9837137deec1657b80c4c9650de21c1/carray/carrayExtension.pyx#L1994), and then implementing multidimensional queries in the next https://github.com/Blosc/bcolz/blob/5b949bfab9837137deec1657b80c4c9650de21c1/carray/carrayExtension.pyx#L2040 method of the ctable iterator. Good luck!

https://github.com/Blosc/bcolz/blob/5b949bfab9837137deec1657b80c4c9650de21c1/carray/carrayExtension.pyx#L2062

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Blosc/bcolz/issues/13#issuecomment-247273314, or mute the thread https://github.com/notifications/unsubscribe-auth/AGyGvbbvqZP1cNTF6zGgU4qNMQfhKpQkks5qqQfMgaJpZM4AHZ5t.

andersglindstrom avatar Sep 15 '16 10:09 andersglindstrom