Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasprobst committed Dec 18, 2023
1 parent 7964052 commit 480b648
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions h5rdmtoolbox/wrapper/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,12 +730,9 @@ def create_dataset(self,
super().create_dataset(name, shape, dtype, data, **kwargs)

# take compression from kwargs or config:
if not kwargs.get('compression', None):
compression = get_config('hdf_compression')
compression_opts = kwargs.pop('compression_opts', get_config('hdf_compression_opts'))
else:
compression = kwargs.pop('compression')
compression_opts = kwargs.pop('compression_opts', None)
compression = kwargs.pop('compression', get_config('hdf_compression'))
compression_opts = kwargs.pop('compression_opts', get_config('hdf_compression_opts'))

if shape is not None:
if len(shape) == 0:
compression, compression_opts, chunks = None, None, None
Expand Down
2 changes: 1 addition & 1 deletion tests/wrapper/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def test_compression(self):
self.assertEqual('gzip', h5['gzip'].compression)
self.assertEqual(1, h5['gzip'].compression_opts)

h5.create_dataset('lzf', data=[1, 2, 3], compression='lzf')
h5.create_dataset('lzf', data=[1, 2, 3], compression='lzf', compression_opts=None)
self.assertEqual('lzf', h5['lzf'].compression)
self.assertEqual(None, h5['lzf'].compression_opts)

Expand Down

0 comments on commit 480b648

Please sign in to comment.