zcollection.collection.Collection.load#

Collection.load(*, delayed=True, filters=None, indexer=None, selected_variables=None)#

Load the selected partitions.

Parameters:
  • delayed (bool) – Whether to load data in a dask array or not.

  • filters (PartitionFilter) – The predicate used to filter the partitions to load. To get more information on the predicate, see the documentation of the partitions() method.

  • indexer (Indexer | None) – The indexer to apply.

  • selected_variables (Iterable[str] | None) – A list of variables to retain from the collection. If None, all variables are kept.

Returns:

The dataset containing the selected partitions, or None if no partitions were selected.

Return type:

dataset.Dataset | None

Warning

If you select variables to load from the collection, do not insert the returned dataset otherwise all skipped variables will be reset with fill values.

Example

>>> collection = ...
>>> collection.load(
...     filters="year == 2019 and month == 3 and day % 2 == 0")
>>> collection.load(
...     filters=lambda keys: keys["year"] == 2019 and
...     keys["month"] == 3 and keys["day"] % 2 == 0)