Skip to content

Commit

Permalink
Tiny fix for 1D arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
JSKenyon committed Aug 17, 2023
1 parent 76b5fac commit 2c52dfe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions daskms/experimental/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def rechunk_by_size(dataset, max_chunk_mem=2**31 - 1, unchunked_dims=None):
rechunked_dataset : xarray.Dataset
Dataset with appropriate chunking.
"""

def _rechunk(data_array, unchunked_dims):
dims = set(data_array.dims)
unchunked_dims = unchunked_dims & dims
Expand All @@ -162,6 +163,9 @@ def _rechunk(data_array, unchunked_dims):

chunk_dict = {k: dim_sizes[k] for k in unchunked_dims}

if n_chunked_dim == 0: # No chunking but still less than target size.
return chunk_dict

ideal_chunk = int(
np.power(max_n_ele / fixed_n_ele, 1 / (n_dim - n_unchunked_dim))
)
Expand Down

0 comments on commit 2c52dfe

Please sign in to comment.