SChunk.__init__#

SChunk.__init__(chunksize=None, data=None, **kwargs)#

Create a new super-chunk.

Parameters:
  • chunksize (int) – The size, in bytes, of the chunks from the super-chunk. If not provided, it is set automatically to a reasonable value.

  • data (bytes-like object, optional) – The data to be split into different chunks of size chunksize. If None, the Schunk instance will be empty initially.

  • kwargs (dict, optional) –

    Keyword arguments supported:

    contiguous: bool

    If the chunks are stored contiguously or not. Default is True when urlpath is not None; False otherwise.

    urlpath: String

    If the storage is persistent, the name of the file (when contiguous = True) or the directory (if contiguous = False). If the storage is in-memory, then this field is None.

    mode: str, optional

    Persistence mode: ‘r’ means read only (must exist); ‘a’ means read/write (create if it doesn’t exist); ‘w’ means create (overwrite if it exists).

    cparams: dict

    A dictionary with the compression parameters, which are the same as those can be used in the compress2() function.

    dparams: dict

    A dictionary with the decompression parameters, which are the same as those that can be used in the decompress2() function.

    meta: dict or None

    A dictionary with different metalayers. One entry per metalayer:

    key: bytes or str

    The name of the metalayer.

    value: object

    The metalayer object that will be serialized using msgpack.

Examples

>>> import blosc2
>>> storage = {"contiguous": True, "cparams": {}, "dparams": {}}
>>> schunk = blosc2.SChunk(**storage)