We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4220a6a commit 2cdcf6eCopy full SHA for 2cdcf6e
src/mdio/core/grid.py
@@ -150,7 +150,12 @@ def _calculate_live_mask_chunksize(grid: Grid) -> Sequence[int]:
150
A sequence of integers representing the optimal chunk size for each dimension
151
of the grid.
152
"""
153
- return _calculate_optimal_chunksize(grid.live_mask, INT32_MAX // 4)
+ try:
154
+ return _calculate_optimal_chunksize(grid.live_mask, INT32_MAX // 4)
155
+ except:
156
+ # Create an empty array with the same shape and dtype as the live mask would have
157
+ empty_array = np.empty(grid.shape[:-1], dtype=np.bool_)
158
+ return _calculate_optimal_chunksize(empty_array, INT32_MAX // 4)
159
160
161
def _calculate_optimal_chunksize( # noqa: C901
0 commit comments