Skip to content

Commit

Permalink
Avoid divide by zero from projected mem (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwhite authored Jul 7, 2023
1 parent 7f112b2 commit ab26568
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cubed/core/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,13 @@ def create_zarr_arrays(lazy_zarr_arrays, reserved_mem):
)
]

# projected memory is size of largest initial values, or 0 if there aren't any
# projected memory is size of largest initial values, or dtype size if there aren't any
projected_mem = (
max(
[
lza.initial_values.nbytes if lza.initial_values is not None else 0
lza.initial_values.nbytes
if lza.initial_values is not None
else lza.dtype.itemsize
for lza in lazy_zarr_arrays
],
default=0,
Expand Down

0 comments on commit ab26568

Please sign in to comment.