Skip to content

Commit

Permalink
Fix for case when chunk_iter is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
rly committed May 14, 2024
1 parent 620b436 commit a39b7f8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lindi/LindiH5ZarrStore/LindiH5ZarrStore.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,13 @@ def _add_chunk_info_to_refs(
)
assert chunk_index == _get_chunk_index(h5_item, chunk_coords)

byte_offset = chunk_info[chunk_index].byte_offset
byte_count = chunk_info[chunk_index].size
# use chunk_info if available on this system because it is more efficient,
# otherwise use the slower _get_chunk_byte_range
if chunk_info is not None:
byte_offset = chunk_info[chunk_index].byte_offset
byte_count = chunk_info[chunk_index].size
else:
byte_offset, byte_count = _get_chunk_byte_range(h5_item, chunk_coords)
except Exception as e:
raise Exception(
f"Error getting byte range for chunk {key_parent}/{key_name}. Shape: {h5_item.shape}, Chunks: {h5_item.chunks}, Chunk coords: {chunk_coords}: {e}"
Expand Down

0 comments on commit a39b7f8

Please sign in to comment.