Skip to content

Save xarray Dataset to hdf5 using LZ4 compression #7386

Answered by ElJekko
ElJekko asked this question in Q&A
Discussion options

You must be logged in to vote

I found an answer, in case this is helpful to someone else.

Apparently hdf5plugin implements the filter option names slightly different as opposed to the standard h5py compression options.
The h5py backend accepts two keywords, compression and compression_opts.

Snippet from the hdf5plugin documentation using h5py directly.

# Compression
f = h5py.File('test.h5', 'w')
f.create_dataset('data', data=numpy.arange(100), **hdf5plugin.LZ4())
f.close()

Notice that compression and compression_opts are not passed explicitly. But notice how the hdf5plugin.LZ4() instance is being unpacked in to kwargs (using **), this must mean it behaves like a dictionary:

dict(hdf5plugin.LZ4())
{'compression': 32004, 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@harzer99
Comment options

Answer selected by ElJekko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants