Discussion:
simple table sorting question
(too old to reply)
Ken Walker
2018-10-24 20:59:32 UTC
Permalink
I'm trying to create a sort index on a simple table (no nested columns).
It looks simple enough in the documentation and emails in this forum.
I have a table at /RESULT/NODE/DISPLACEMENT
(or File.root.RESULT.NODE.DISPLACEMENT)
It has several columns. The one I'd like to sort is called DOMAIN.

I thought this code would do the job, but when I run, get a huge trace back.

h5_file = tables.open_file('test_sort.h5', mode='r+')
res_table=h5_file.root.RESULT.NODE.DISPLACEMENT
res_table.cols.DOMAIN.create_index()

What am I missing? I'm sure I've overlooked something simple.
Also is there way to sort on 2 columns? first on DOMAIN, then on another
column?

Thanks,
-Ken
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Francesc Alted
2018-10-25 07:23:08 UTC
Permalink
Hi Ken,
Post by Ken Walker
I'm trying to create a sort index on a simple table (no nested columns).
It looks simple enough in the documentation and emails in this forum.
I have a table at /RESULT/NODE/DISPLACEMENT
(or File.root.RESULT.NODE.DISPLACEMENT)
It has several columns. The one I'd like to sort is called DOMAIN.
I thought this code would do the job, but when I run, get a huge trace back.
h5_file = tables.open_file('test_sort.h5', mode='r+')
res_table=h5_file.root.RESULT.NODE.DISPLACEMENT
res_table.cols.DOMAIN.create_index()
What am I missing? I'm sure I've overlooked something simple.
We need more information. Could you send the backtrace (a self-contained
example would also be nice)? Also, filling a an issue in github would be
good.
Post by Ken Walker
Also is there way to sort on 2 columns? first on DOMAIN, then on another
column?
Sorry, but combined sorts are not implemented.

Cheers,
--
Francesc Alted
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ken Walker
2018-10-25 17:22:23 UTC
Permalink
Francesc,
Thanks for your response.
The HDF5 file is created by a 3rd party, so I don't have a self-contained
example. Sorry.
The create_index() examples I saw looked pretty simple once a column handle
was created.
I will work thru the tutorials, and see if I can answer my question or
replicate my problem.
Thanks,
-Ken
Post by Francesc Alted
Hi Ken,
Post by Ken Walker
I'm trying to create a sort index on a simple table (no nested columns).
It looks simple enough in the documentation and emails in this forum.
I have a table at /RESULT/NODE/DISPLACEMENT
(or File.root.RESULT.NODE.DISPLACEMENT)
It has several columns. The one I'd like to sort is called DOMAIN.
I thought this code would do the job, but when I run, get a huge trace back.
h5_file = tables.open_file('test_sort.h5', mode='r+')
res_table=h5_file.root.RESULT.NODE.DISPLACEMENT
res_table.cols.DOMAIN.create_index()
What am I missing? I'm sure I've overlooked something simple.
We need more information. Could you send the backtrace (a self-contained
example would also be nice)? Also, filling a an issue in github would be
good.
Post by Ken Walker
Also is there way to sort on 2 columns? first on DOMAIN, then on another
column?
Sorry, but combined sorts are not implemented.
Cheers,
--
Francesc Alted
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ken Walker
2018-10-25 18:23:06 UTC
Permalink
It didn't take long to figure out the source of my problems (although I
haven't figured out the solution).
As I mentioned, the problematic HDF5 file is created by a 3rd party
(probably written with HDFGroup C/C++ API).
I have a Pytables utility that creates a second file by copying parts of
each table (using .read_where() from the first file/table and adding to the
second file/table with .append()).
When I run code from my first post against my second HDF5 (Pytables) file,
indexing works perfectly.
A review of the traceback when indexing the first file shows Pytables
expects to find 1 or more attributes that are not in my original HDF5 file.
Post by Ken Walker
Francesc,
Thanks for your response.
The HDF5 file is created by a 3rd party, so I don't have a self-contained
example. Sorry.
The create_index() examples I saw looked pretty simple once a column
handle was created.
I will work thru the tutorials, and see if I can answer my question or
replicate my problem.
Thanks,
-Ken
Post by Francesc Alted
Hi Ken,
Post by Ken Walker
I'm trying to create a sort index on a simple table (no nested columns).
It looks simple enough in the documentation and emails in this forum.
I have a table at /RESULT/NODE/DISPLACEMENT
(or File.root.RESULT.NODE.DISPLACEMENT)
It has several columns. The one I'd like to sort is called DOMAIN.
I thought this code would do the job, but when I run, get a huge trace back.
h5_file = tables.open_file('test_sort.h5', mode='r+')
res_table=h5_file.root.RESULT.NODE.DISPLACEMENT
res_table.cols.DOMAIN.create_index()
What am I missing? I'm sure I've overlooked something simple.
We need more information. Could you send the backtrace (a self-contained
example would also be nice)? Also, filling a an issue in github would be
good.
Post by Ken Walker
Also is there way to sort on 2 columns? first on DOMAIN, then on another
column?
Sorry, but combined sorts are not implemented.
Cheers,
--
Francesc Alted
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Francesc Alted
2018-10-26 07:23:23 UTC
Permalink
I see. Yes, that makes sense. Actually providing more support for tables
that have not been created with PyTables would be a good thing (perhaps a
good project for applying for a NumFOCUS grant?).

Francesc
Post by Ken Walker
It didn't take long to figure out the source of my problems (although I
haven't figured out the solution).
As I mentioned, the problematic HDF5 file is created by a 3rd party
(probably written with HDFGroup C/C++ API).
I have a Pytables utility that creates a second file by copying parts of
each table (using .read_where() from the first file/table and adding to the
second file/table with .append()).
When I run code from my first post against my second HDF5 (Pytables) file,
indexing works perfectly.
A review of the traceback when indexing the first file shows Pytables
expects to find 1 or more attributes that are not in my original HDF5 file.
Post by Ken Walker
Francesc,
Thanks for your response.
The HDF5 file is created by a 3rd party, so I don't have a self-contained
example. Sorry.
The create_index() examples I saw looked pretty simple once a column
handle was created.
I will work thru the tutorials, and see if I can answer my question or
replicate my problem.
Thanks,
-Ken
Post by Francesc Alted
Hi Ken,
Post by Ken Walker
I'm trying to create a sort index on a simple table (no nested columns).
It looks simple enough in the documentation and emails in this forum.
I have a table at /RESULT/NODE/DISPLACEMENT
(or File.root.RESULT.NODE.DISPLACEMENT)
It has several columns. The one I'd like to sort is called DOMAIN.
I thought this code would do the job, but when I run, get a huge trace back.
h5_file = tables.open_file('test_sort.h5', mode='r+')
res_table=h5_file.root.RESULT.NODE.DISPLACEMENT
res_table.cols.DOMAIN.create_index()
What am I missing? I'm sure I've overlooked something simple.
We need more information. Could you send the backtrace (a
self-contained example would also be nice)? Also, filling a an issue in
github would be good.
Post by Ken Walker
Also is there way to sort on 2 columns? first on DOMAIN, then on
another column?
Sorry, but combined sorts are not implemented.
Cheers,
--
Francesc Alted
--
You received this message because you are subscribed to the Google Groups
"pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Francesc Alted
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...