Skip to content

Commit

Permalink
Use auto rechunking in da.rechunk if no value given
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed Nov 19, 2019
1 parent 7967652 commit 1f4a00c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dask/array/core.py
Expand Up @@ -2164,7 +2164,7 @@ def squeeze(self, axis=None):

return squeeze(self, axis)

def rechunk(self, chunks, threshold=None, block_size_limit=None):
def rechunk(self, chunks="auto", threshold=None, block_size_limit=None):
""" See da.rechunk for docstring """
from . import rechunk # avoid circular import

Expand Down
2 changes: 1 addition & 1 deletion dask/array/rechunk.py
Expand Up @@ -181,7 +181,7 @@ def intersect_chunks(old_chunks, new_chunks):
return cross


def rechunk(x, chunks, threshold=None, block_size_limit=None):
def rechunk(x, chunks="auto", threshold=None, block_size_limit=None):
"""
Convert blocks in dask array x for new chunks.
Expand Down
7 changes: 7 additions & 0 deletions dask/array/tests/test_array_core.py
Expand Up @@ -4224,3 +4224,10 @@ def test_compute_chunk_sizes_warning_fixes_slicing():
y[:3, :]
y.compute_chunk_sizes()
y[:3, :]


def test_rechunk_auto():
x = da.ones(10, chunks=(1,))
y = x.rechunk()

assert y.npartitions == 1

0 comments on commit 1f4a00c

Please sign in to comment.