zcollection.view.View#

class zcollection.view.View(base_dir, view_ref, *, ds, filesystem=None, filters=None, synchronizer=None)[source]#

Bases: object

View on a reference collection.

Parameters:
  • base_dir (str) – Path to the directory where the view is stored.

  • view_ref (ViewReference) – Access properties for the reference view.

  • ds (meta.Dataset | None) – The dataset handled by this view.

  • filesystem (fsspec.AbstractFileSystem | str | None) – The file system used to access the view.

  • filters (collection.PartitionFilter) – The filters used to select the partitions of the reference. If not provided, all partitions are selected.

  • synchronizer (sync.Sync | None) – The synchronizer used to synchronize the view.

Note

Normally, you should not call this constructor directly. Instead, use create_view or open_view to create or open a view.

Attributes

CONFIG

Configuration filename of the view.

fs

The file system used to access the view (default local file system).

base_dir

Path to the directory where the view is stored.

view_ref

The reference collection of the view.

metadata

The metadata of the variables handled by the view.

synchronizer

The synchronizer used to synchronize the view.

filters

The filters used to select the partitions of the reference.

Public Methods

add_variable(variable)

Add a variable to the view.

drop_variable(varname)

Drop a variable from the view.

from_config(path, *[, filesystem, synchronizer])

Open a View described by a configuration file.

is_synced()

Check if the view is synchronized with the underlying collection.

load(*[, delayed, filters, indexer, ...])

Load the view.

map(func, /, *args[, delayed, filters, ...])

Map a function over the partitions of the view.

map_overlap(func, /, *args[, depth, ...])

Map a function over the partitions of the view with some overlap.

partitions([filters])

Returns the list of partitions in the view.

sync([filters])

Synchronize the view with the underlying collection.

update(func, /, *args[, depth, delayed, ...])

Update a variable stored int the view.

variables([selected_variables])

Return the variables of the view.

Protected Methods

_config(base_dir)

Returns the configuration path.

_init_partitions(filters)

Initialize the partitions of the view.

_write_config()

Write the configuration file for the view.

Special Methods

__str__()

Return str(self).