Skip to content

Commit

Permalink
Improved error messages
Browse files Browse the repository at this point in the history
We are testing fsspec-reference-maker on many HDF5 files and most of the break. It is helpful to know more about why they break so I added test-specific error messages.
  • Loading branch information
tedhabermann committed Jun 30, 2021
1 parent 67ccf71 commit 2f0e356
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions fsspec_reference_maker/hdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,18 @@ def _translator(self, name: str, h5obj: Union[h5py.Dataset, h5py.Group]):
f'{h5obj.shape} {h5obj.dtype} {h5obj.nbytes} bytes>')
return

if (h5obj.scaleoffset or h5obj.fletcher32 or
h5obj.compression in ('szip', 'lzf')):
#
# check for unsupported dataset properties
#
if h5obj.scaleoffset:
raise RuntimeError(
f'{h5obj.name} uses unsupported HDF5 filters')
f'{h5obj.name} uses HDF5 scaleoffset filter - not supported by reference-maker')
if h5obj.fletcher32:
raise RuntimeError(
f'{h5obj.name} uses fletcher32 checksum - not supported by reference-maker')
if h5obj.compression in ('szip', 'lzf'):
raise RuntimeError(
f'{h5obj.name} uses szip or lzf compression - not supported by reference-maker')
if h5obj.compression == 'gzip':
compression = numcodecs.Zlib(level=h5obj.compression_opts)
else:
Expand Down

0 comments on commit 2f0e356

Please sign in to comment.