zcollection.meta.Variable#

class zcollection.meta.Variable(name, dtype, *, dimensions=None, attrs=None, compressor=None, fill_value=None, filters=None)[source]#

Bases: object

Handle the metadata of a dataset variable.

Parameters:
  • name (str) – Name of the variable.

  • dtype (DTypeLike) – Data type of the variable.

  • dimensions (Sequence[str] | None) – Names of the dimensions of the variable. Defaults to None.

  • attrs (Sequence[Attribute] | None) – Attributes of the variable. Defaults to None.

  • compressor (numcodecs.abc.Codec | None) – Compression codec for the variable. Defaults to None.

  • fill_value (Any | None) – Fill value for the variable. Defaults to None.

  • filters (Sequence[numcodecs.abc.Codec] | None) – Filters for the variable. Defaults to None.

Warning

If the variable uses filters, the fill_value parameter must be the value that results from decoding the filter. For example, if the filter is FixedScaleOffset(0, 1000) and the desired fill_value is 65536, then the fill_value parameter must be 65536 / 1000 = 65.536.

Attributes

attrs

Attributes of the variable.

compressor

Compression codec for the variable.

dimensions

Dimensions of the variable.

dtype

Data type of the variable.

fill_value

Fill value for the variable.

filters

Filter codecs for the variable.

name

Variable name.

Public Methods

from_config(data)

Create a new variable from the given variable configuration.

get_config()

Get the variable metadata.

set_for_insertion()

Create a new variable without any attribute.

Special Methods

__eq__(other)

Return self==value.

__repr__()

Return repr(self).