1
1
from __future__ import absolute_import , division , print_function
2
2
3
+ import warnings
4
+
3
5
from distutils .version import LooseVersion
4
6
5
7
import numpy as np
@@ -327,11 +329,11 @@ def sync(self):
327
329
pass
328
330
329
331
330
- def open_zarr (store , group = None , synchronizer = None , chunks = None ,
332
+ def open_zarr (store , group = None , synchronizer = None , chunks = 'auto' ,
331
333
decode_cf = True , mask_and_scale = True , decode_times = True ,
332
334
concat_characters = True , decode_coords = True ,
333
- drop_variables = None , auto_chunk = True ,
334
- overwrite_encoded_chunks = False ):
335
+ drop_variables = None , overwrite_encoded_chunks = False ,
336
+ ** kwargs ):
335
337
"""Load and decode a dataset from a Zarr store.
336
338
337
339
.. note:: Experimental
@@ -354,13 +356,8 @@ def open_zarr(store, group=None, synchronizer=None, chunks=None,
354
356
chunks : int or dict or {None, 'auto'}, optional
355
357
Chunk sizes along each dimension, e.g., ``5`` or
356
358
``{'x': 5, 'y': 5}``. If `chunks='auto'`, dask chunks are created
357
- based on the variable's zarr chunks. If `chunks=None` and
358
- `auto_chunk=False`, zarr array data will lazily convert to numpy
359
- arrays upon access.
360
- auto_chunk : bool, optional
361
- Whether to automatically create dask chunks corresponding to each
362
- variable's zarr chunks. If `chunks=None`, this overrides `chunks`.
363
- Equivalent to `chunks='auto'.` (Default: True)
359
+ based on the variable's zarr chunks. If `chunks=None`, zarr array
360
+ data will lazily convert to numpy arrays upon access.
364
361
overwrite_encoded_chunks: bool, optional
365
362
Whether to drop the zarr chunks encoded for each variable when a
366
363
dataset is loaded with specified chunk sizes (default: False)
@@ -404,9 +401,19 @@ def open_zarr(store, group=None, synchronizer=None, chunks=None,
404
401
----------
405
402
http://zarr.readthedocs.io/
406
403
"""
407
-
408
- if auto_chunk and chunks is None :
409
- chunks = 'auto' # maintain backwards compatibility
404
+ if 'auto_chunk' in kwargs :
405
+ auto_chunk = kwargs .pop ('auto_chunk' )
406
+ if auto_chunk == True :
407
+ chunks = 'auto' # maintain backwards compatibility
408
+ elif auto_chunk == False :
409
+ chunks = None
410
+
411
+ warnings .warn ("auto_chunk is deprecated. Use chunks='auto' instead." ,
412
+ FutureWarning , stacklevel = 2 )
413
+
414
+ if kwargs :
415
+ raise TypeError ("open_zarr() got unexpected keyword arguments " +
416
+ "," .join (kwargs .keys ()))
410
417
411
418
if not isinstance (chunks , (int , dict )):
412
419
if chunks != 'auto' and chunks is not None :
0 commit comments