xdas.processing.DataArrayWriter#
- class xdas.processing.DataArrayWriter(dirpath, encoding=None, max_buffers=1, max_workers=1, create_dirs=False)[source]#
A class to handle chunked data egress.
- Parameters:
dirpath (str or Path) – The directory to store the output of a processing pipeline. The directory needs to exist and be empty.
encoding (dict) – The encoding to use when dumping the DataArrays to bytes.
max_buffers (int, default=1) – The maximum number of chunks to load into memory at the same time.
max_workers (int, default=1) – The maximum number of thread used to load the chunks.
create_dirs (bool, optional) – Whether to create parent directories if they do not exist. Default is False.
Examples
>>> import xdas as xd >>> import xdas.processing as xp
>>> expected = xd.DataArray(np.random.rand(1000, 100), dims=("time", "distance"))
>>> dw = DataArrayWriter("some_path") >>> for chunk in chunks: ... dw.submit(chunk) >>> result = dw.result
>>> assert result.equals(expected)
Methods