Skip to content

Commit c6659e2

Browse files
author
David Stuebe
committed
hack chunk_getitem with a try except
1 parent cb3908b commit c6659e2

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

zarr/core.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,16 +2225,27 @@ def _chunk_getitems(
22252225

22262226
for ckey, chunk_select, out_select in zip(ckeys, lchunk_selection, lout_selection):
22272227
if ckey in cdatas:
2228-
self._process_chunk(
2229-
out,
2230-
cdatas[ckey],
2231-
chunk_select,
2232-
drop_axes,
2233-
out_is_ndarray,
2234-
fields,
2235-
out_select,
2236-
partial_read_decode=partial_read_decode,
2237-
)
2228+
try:
2229+
self._process_chunk(
2230+
out,
2231+
cdatas[ckey],
2232+
chunk_select,
2233+
drop_axes,
2234+
out_is_ndarray,
2235+
fields,
2236+
out_select,
2237+
partial_read_decode=partial_read_decode,
2238+
)
2239+
except RuntimeError:
2240+
raise
2241+
except Exception as e:
2242+
print(f"Ignoring exception {type(e)}:'{e}' in _process_chunk: ckey:{ckey}; fields:{fields}; chunk_select:{chunk_select}; out_select: {out_select} fill_value:{self._fill_value};")
2243+
if self._fill_value is not None:
2244+
if fields:
2245+
fill_value = self._fill_value[fields]
2246+
else:
2247+
fill_value = self._fill_value
2248+
out[out_select] = fill_value
22382249
else:
22392250
# check exception type
22402251
if self._fill_value is not None:

0 commit comments

Comments
 (0)