Skip to content

Commit

Permalink
Merge pull request #432 from martindurant/fix_hdf_inline
Browse files Browse the repository at this point in the history
inlining was not happening for HDF
  • Loading branch information
martindurant authored Mar 5, 2024
2 parents 7377869 + 68bd4a0 commit 6fe1f0a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kerchunk/hdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,19 @@ def _translator(self, name: str, h5obj: Union[h5py.Dataset, h5py.Group]):
if h5obj.fletcher32:
logging.info("Discarding fletcher32 checksum")
v["size"] -= 4
if self.inline and isinstance(v, list) and v[2] < self.inline:
if (
self.inline
and isinstance(v, dict)
and v["size"] < self.inline
):
self.input_file.seek(v["offset"])
data = self.input_file.read(v["size"])
try:
# easiest way to test if data is ascii
data.decode("ascii")
except UnicodeDecodeError:
data = b"base64:" + base64.b64encode(data)
self.store[k] = data
self.store[za._chunk_key(k)] = data
else:
self.store[za._chunk_key(k)] = [
self._uri,
Expand Down

0 comments on commit 6fe1f0a

Please sign in to comment.