Skip to content

Commit

Permalink
Fix ZeroDivisionError by adding back check that chunks is not False
Browse files Browse the repository at this point in the history
Yet another if-statement that wasn't properly transferred from zarr.py to api.py.
  • Loading branch information
weiji14 committed Jul 1, 2020
1 parent 0b34ab8 commit 6fbeadf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion xarray/backends/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,12 @@ def maybe_decode_store(store, chunks, lock=False):
ds2 = ds.chunk(chunks, name_prefix=name_prefix, token=token)
ds2._file_obj = ds._file_obj

else:
else: # if engine=="zarr":
# auto chunking needs to be here and not in ZarrStore because
# the variable chunks does not survive decode_cf
# return trivial case
if not chunks: # e.g. chunks is 0 or chunks is {}
return ds

# adapted from Dataset.Chunk() and taken from open_zarr
if not isinstance(chunks, (int, dict)):
Expand Down

0 comments on commit 6fbeadf

Please sign in to comment.