zcollection.variable.array.Array#

class zcollection.variable.array.Array(name, data, dimensions, *, attrs=None, compressor=None, fill_value=None, filters=None)[source]#

Bases: Variable

Access to the chunked data using numpy arrays.

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

  • data (ArrayLike[Any]) – Variable data

  • dimensions (Sequence[str]) – Variable dimensions

  • attrs (Sequence[Attribute] | None) – Variable attributes

  • compressor (Codec | None) – Compression codec

  • fill_value (Any | None) – Value to use for uninitialized values

  • filters (Sequence[numcodecs.abc.Codec] | None) – Filters to apply before writing data to disk

Attributes

array

Variable data as a dask array.

attrs

Variable attributes

compressor

Compressor used to compress the data during writing data to disk

dimensions

Variable dimensions

fill_value

Value to use for uninitialized values

filters

Filters to apply before writing data to disk

name

Variable name

data

Return the numpy array wrapped in a dask array.

dtype

Return the dtype of the underlying array.

nbytes

Return the number of bytes used by the variable.

ndim

Return the number of dimensions of the variable.

shape

Return the shape of the variable.

size

Return the size of the variable.

values

Return the variable data as a numpy array.

Public Methods

compute(**_)

Return the variable data as a numpy array.

concat(other, dim)

Concatenate this variable with another variable or a list of variables along a dimension.

fill()

Fill the variable with the fill value.

from_zarr(array, name, dimension, **kwargs)

Create a new variable from a zarr array.

persist(**_)

Persist the variable data into memory.

rechunk(**_)

Rechunk the variable.

Protected Methods

Special Methods

__getitem__(key)

Get a slice of the variable.

Inherited Methods

dimension_index()

Return an iterator over the variable dimensions and their index.

duplicate(data)

Create a new variable from the properties of this instance and the data provided.

fill_attrs(var)

Fill the variable attributes using the provided metadata.

have_same_properties(other)

Return true if this instance and the other variable have the same properties.

isel(key)

Return a new variable with data selected along the given dimension indices.

metadata()

Get the variable metadata.

rename(name)

Rename the variable.

set_for_insertion()

Create a new variable without any attribute.

to_xarray()

Convert the variable to an xarray.Variable.