how to get Filters for a Table (or Carray)?

13 views
Skip to first unread message

Ken Walker

unread,
Jul 9, 2020, 1:19:08 PM7/9/20
to pytables-users
I'm writing a routine to copy Tables and Carrays between 2 HDF5 files.
I'd like to create the destination file using the same compression Filters as the source file.
I know how to create and apply Filters for the destination file.
What I can't figure out is how do I get the Filter values from the source table.
Is this in the documentation or examples?
Suggestions are appreciated.

-Ken

Francesc Alted

unread,
Jul 9, 2020, 1:42:30 PM7/9/20
to Ken Walker, pytables-users
Hi Ken,

Well, the default is precisely to copy the datasets (leaves in PyTables parlance) using exactly the same filters than the origin: http://www.pytables.org/usersguide/libref/hierarchy_classes.html?highlight=copy#tables.Leaf.copy

Having said that, you can always access the filters via the `.filters` attribute (http://www.pytables.org/usersguide/libref/hierarchy_classes.html?highlight=copy#tables.Leaf.filters) and pass it explicitly to the copy() function if you want to be explicit.

Finally, make sure that you have a look at the `ptrepack` command line utility (http://www.pytables.org/usersguide/utilities.html?highlight=ptrepack#ptrepack), as it has a lot of interesting features so as to copy leaves or hierarchies from one HDF5 file to another.

Francesc

--
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-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pytables-users/617f5964-5323-4e63-9fa8-b3b8e22db99ao%40googlegroups.com.


--
Francesc Alted

Ken Walker

unread,
Jul 9, 2020, 3:28:35 PM7/9/20
to pytables-users
Hi Francesc,
Thanks for the quick and helpful response! I checked Table and Carray docs for attributes, and didn't think to look at the Hierarchy/Leaf class docs. Good stuff. 
I left some details out. I'm not copying the entire Table to another file. I'm reading a subset of rows into an array with .read_where(), then creating a new table with the extracted data. This will be helpful to get the source Filters and apply to my new file.
Thanks!!
-Ken

On Thursday, July 9, 2020 at 12:42:30 PM UTC-5, faltet wrote:
Hi Ken,

Well, the default is precisely to copy the datasets (leaves in PyTables parlance) using exactly the same filters than the origin: http://www.pytables.org/usersguide/libref/hierarchy_classes.html?highlight=copy#tables.Leaf.copy

Having said that, you can always access the filters via the `.filters` attribute (http://www.pytables.org/usersguide/libref/hierarchy_classes.html?highlight=copy#tables.Leaf.filters) and pass it explicitly to the copy() function if you want to be explicit.

Finally, make sure that you have a look at the `ptrepack` command line utility (http://www.pytables.org/usersguide/utilities.html?highlight=ptrepack#ptrepack), as it has a lot of interesting features so as to copy leaves or hierarchies from one HDF5 file to another.

Francesc

On Thu, Jul 9, 2020 at 7:19 PM Ken Walker <ken.c...@gmail.com> wrote:
I'm writing a routine to copy Tables and Carrays between 2 HDF5 files.
I'd like to create the destination file using the same compression Filters as the source file.
I know how to create and apply Filters for the destination file.
What I can't figure out is how do I get the Filter values from the source table.
Is this in the documentation or examples?
Suggestions are appreciated.

-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 pytable...@googlegroups.com.


--
Francesc Alted
Reply all
Reply to author
Forward
0 new messages