1
1
import os
2
2
import pathlib
3
- from distutils .version import LooseVersion
4
3
import warnings
4
+ from distutils .version import LooseVersion
5
5
6
6
import numpy as np
7
7
@@ -171,8 +171,8 @@ def _determine_zarr_chunks(enc_chunks, var_chunks, ndim, name, safe_chunks):
171
171
)
172
172
if safe_chunks :
173
173
raise ValueError (
174
- base_error +
175
- "Consider either rechunking using `chunk()`, deleting "
174
+ base_error
175
+ + "Consider either rechunking using `chunk()`, deleting "
176
176
"or modifying `encoding['chunks']`, or specify `safe_chunks=False`."
177
177
)
178
178
else :
@@ -188,8 +188,8 @@ def _determine_zarr_chunks(enc_chunks, var_chunks, ndim, name, safe_chunks):
188
188
)
189
189
if safe_chunks :
190
190
raise ValueError (
191
- base_error +
192
- "Consider either rechunking using `chunk()`, deleting "
191
+ base_error
192
+ + "Consider either rechunking using `chunk()`, deleting "
193
193
"or modifying `encoding['chunks']`, or specify `safe_chunks=False`."
194
194
)
195
195
else :
@@ -215,7 +215,9 @@ def _get_zarr_dims_and_attrs(zarr_obj, dimension_key):
215
215
return dimensions , attributes
216
216
217
217
218
- def extract_zarr_variable_encoding (variable , raise_on_invalid = False , name = None , safe_chunks = True ):
218
+ def extract_zarr_variable_encoding (
219
+ variable , raise_on_invalid = False , name = None , safe_chunks = True
220
+ ):
219
221
"""
220
222
Extract zarr encoding dictionary from xarray Variable
221
223
@@ -297,7 +299,7 @@ class ZarrStore(AbstractWritableDataStore):
297
299
"_read_only" ,
298
300
"_synchronizer" ,
299
301
"_write_region" ,
300
- "_safe_chunks"
302
+ "_safe_chunks" ,
301
303
)
302
304
303
305
@classmethod
@@ -313,7 +315,7 @@ def open_group(
313
315
storage_options = None ,
314
316
append_dim = None ,
315
317
write_region = None ,
316
- safe_chunks = True
318
+ safe_chunks = True ,
317
319
):
318
320
319
321
# zarr doesn't support pathlib.Path objects yet. zarr-python#601
@@ -337,11 +339,17 @@ def open_group(
337
339
zarr_group = zarr .open_consolidated (store , ** open_kwargs )
338
340
else :
339
341
zarr_group = zarr .open_group (store , ** open_kwargs )
340
- return cls (zarr_group , consolidate_on_close , append_dim , write_region , safe_chunks )
342
+ return cls (
343
+ zarr_group , consolidate_on_close , append_dim , write_region , safe_chunks
344
+ )
341
345
342
346
def __init__ (
343
- self , zarr_group , consolidate_on_close = False , append_dim = None , write_region = None ,
344
- safe_chunks = True
347
+ self ,
348
+ zarr_group ,
349
+ consolidate_on_close = False ,
350
+ append_dim = None ,
351
+ write_region = None ,
352
+ safe_chunks = True ,
345
353
):
346
354
self .ds = zarr_group
347
355
self ._read_only = self .ds .read_only
0 commit comments