Skip to content

Commit d786a5b

Browse files
committed
document set_blosc_options
1 parent f4e7140 commit d786a5b

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

zarr/ext.pyx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ cdef extern from "blosc.h":
7474

7575

7676
def blosc_version():
77-
"""Return the version of c-blosc that zarr was compiled with."""
77+
"""Return the version of blosc that zarr was compiled with."""
7878

7979
# all the 'decode' contorsions are for Python 3 returning actual strings
8080
ver_str = <char *> BLOSC_VERSION_STRING
@@ -97,7 +97,24 @@ def destroy():
9797
_blosc_use_context = False
9898

9999

100-
def set_blosc_options(use_context, nthreads=None):
100+
def set_blosc_options(use_context=False, nthreads=None):
101+
"""Set options for how the blosc compressor is used.
102+
103+
Parameters
104+
----------
105+
use_context : bool, optional
106+
If False, blosc will be used in non-contextual mode, which is best
107+
when using zarr in a single-threaded environment because it allows
108+
blosc to use multiple threads internally. If True, blosc will be used
109+
in contextual mode, which is better when using zarr in a
110+
multi-threaded environment like dask.array because it avoids the blosc
111+
global lock and so multiple blosc operations can be running
112+
concurrently.
113+
nthreads : int, optional
114+
Number of internal threads to use when running blosc in non-contextual
115+
mode.
116+
117+
"""
101118
global _blosc_use_context
102119
_blosc_use_context = use_context
103120
if not use_context:

0 commit comments

Comments
 (0)