Skip to content

Commit 2cdcf6e

Browse files
committed
Update to handle live_mask not existing in Grid
1 parent 4220a6a commit 2cdcf6e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/mdio/core/grid.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,12 @@ def _calculate_live_mask_chunksize(grid: Grid) -> Sequence[int]:
150150
A sequence of integers representing the optimal chunk size for each dimension
151151
of the grid.
152152
"""
153-
return _calculate_optimal_chunksize(grid.live_mask, INT32_MAX // 4)
153+
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)
154159

155160

156161
def _calculate_optimal_chunksize( # noqa: C901

0 commit comments

Comments
 (0)