SChunk.__init__#

SChunk.__init__(chunksize=8000000, data=None, mode='a', **kwargs)#

Create a new super-chunk.

If data is different from None, the data is split into chunks of size chunksize and these chunks are appended into the created SChunk.

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

  • data (bytes-like object, optional) – The data to be split into different chunks of size chunksize.

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

  • kwargs (dict, optional) –

    Keyword arguments supported:

    contiguous: bool

    If the chunks are stored contiguously or not.

    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.

    cparams: dict

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

    dparams: dict

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

Examples

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