File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -55,18 +55,6 @@ def normalize_chunks(
5555 """Called by open_dataset"""
5656 from dask .array .core import normalize_chunks
5757
58- if any (c == "preserve" for c in chunks ) and any (c == "auto" for c in chunks ):
59- raise ValueError ('chunks cannot use a combination of "auto" and "preserve"' )
60-
61- if shape and previous_chunks and any (c == "preserve" for c in chunks ):
62- chunks = self .preserve_chunks (
63- chunks ,
64- shape = shape ,
65- target = self .get_auto_chunk_size (),
66- typesize = getattr (dtype , "itemsize" , 8 ),
67- previous_chunks = previous_chunks ,
68- )
69-
7058 return normalize_chunks (
7159 chunks ,
7260 shape = shape ,
Original file line number Diff line number Diff line change @@ -236,6 +236,20 @@ def _get_chunk( # type: ignore[no-untyped-def]
236236 limit = None
237237 dtype = data .dtype
238238
239+ if any (c == "preserve" for c in chunk_shape ) and any (
240+ c == "auto" for c in chunk_shape
241+ ):
242+ raise ValueError ('chunks cannot use a combination of "auto" and "preserve"' )
243+
244+ if shape and preferred_chunk_shape and any (c == "preserve" for c in chunk_shape ):
245+ chunk_shape = chunkmanager .preserve_chunks (
246+ chunk_shape ,
247+ shape = shape ,
248+ target = chunkmanager .get_auto_chunk_size (),
249+ typesize = getattr (dtype , "itemsize" , 8 ),
250+ previous_chunks = preferred_chunk_shape ,
251+ )
252+
239253 chunk_shape = chunkmanager .normalize_chunks (
240254 chunk_shape ,
241255 shape = shape ,
You can’t perform that action at this time.
0 commit comments