zcollection.create_collection#

zcollection.create_collection(axis, ds, partition_handler, partition_base_dir, **kwargs)[source]#

Create a collection.

Parameters:
  • axis (str) – The axis to use for the collection.

  • ds (Dataset | Dataset) – The dataset to use.

  • partition_handler (Partitioning) – The partitioning handler to use.

  • partition_base_dir (str) – The base directory to use for the partitions.

  • **kwargs – Additional parameters are passed through to the constructor of the class Collection.

Return type:

Collection

Example

>>> import xarray as xr
>>> import zcollection
>>> data = xr.Dataset({
...     "a": xr.DataArray([1, 2, 3]),
...     "b": xr.DataArray([4, 5, 6])
... })
>>> collection = zcollection.create_collection(
...     "a", data,
...     zcollection.partitioning.Sequence(("a", )),
...     "/tmp/my_collection")
Returns:

The collection.

Raises:

ValueError – If the base directory already exists.

Parameters:
Return type:

Collection