NumPy NPZ backend

dsch backend for NumPy’s npz format.

This backend provides support for NumPy’s npz format. For details, see numpy.savez(), numpy.load() and the corresponding NumPy enhancement proposal.

class dsch.backends.npz.Array(schema_node, parent, data_storage=None, new_params=None)

Bases: dsch.data.Array, dsch.backends.npz._ItemNode

Array-type data node for the npz backend.

replace(new_value)

Completely replace the current node value.

Instead of changing parts of the data (e.g. via numpy array slicing), replace the entire data object for this node.

Parameters:new_value – New value to apply to the node, independent of the backend in use.
class dsch.backends.npz.Bool(schema_node, parent, data_storage=None, new_params=None)

Bases: dsch.backends.npz._ItemNode

Bool-type data node for the npz backend.

replace(new_value)

Completely replace the current node value.

Instead of changing parts of the data (e.g. via numpy array slicing), replace the entire data object for this node.

Parameters:new_value – New value to apply to the node, independent of the backend in use.
class dsch.backends.npz.Bytes(schema_node, parent, data_storage=None, new_params=None)

Bases: dsch.backends.npz._ItemNode

Bytes-type data node for the npz backend.

replace(new_value)

Completely replace the current node value.

Instead of changing parts of the data (e.g. via numpy array slicing), replace the entire data object for this node.

Parameters:new_value – New value to apply to the node, independent of the backend in use.
class dsch.backends.npz.Compilation(schema_node, parent, data_storage=None, new_params=None)

Bases: dsch.data.Compilation

Compilation-type data node for the npz backend.

save()

Export the node data as a data storage object.

For Compilation, data is represented as a dict containing the sub-node names as keys and their respective data storage object as values.

Returns:Data storage object with the node’s data.
Return type:dict
class dsch.backends.npz.Date(schema_node, parent, data_storage=None, new_params=None)

Bases: dsch.data.Date, dsch.backends.npz._ItemNode

Date-type data node for the npz backend.

replace(new_value)

Completely replace the current node value.

Instead of changing parts of the data (e.g. via numpy array slicing), replace the entire data object for this node.

Parameters:new_value – New value to apply to the node, independent of the backend in use.
class dsch.backends.npz.DateTime(schema_node, parent, data_storage=None, new_params=None)

Bases: dsch.data.DateTime, dsch.backends.npz._ItemNode

DateTime-type data node for the npz backend.

replace(new_value)

Completely replace the current node value.

Instead of changing parts of the data (e.g. via numpy array slicing), replace the entire data object for this node.

Parameters:new_value – New value to apply to the node, independent of the backend in use.
class dsch.backends.npz.List(schema_node, parent, data_storage=None, new_params=None)

Bases: dsch.data.List

List-type data node for the npz backend.

save()

Export the node data as a data storage object.

For List, data is represented as a dict containing the sub-node’s data storage objects as values and keys of the form item_X, where X is the list index.

Returns:Data storage object with the node’s data.
Return type:dict
class dsch.backends.npz.Scalar(schema_node, parent, data_storage=None, new_params=None)

Bases: dsch.data.Scalar, dsch.backends.npz._ItemNode

Scalar-type data node for the npz backend.

replace(new_value)

Completely replace the current node value.

Instead of changing parts of the data (e.g. via numpy array slicing), replace the entire data object for this node.

Parameters:new_value – New value to apply to the node, independent of the backend in use.
class dsch.backends.npz.Storage(storage_path, schema_node=None)

Bases: dsch.storage.FileStorage

Interface to .npz files.

Provides access to an .npz file via dsch, i.e. reading from and writing to such a file.

Variables:
  • storage_path (str) – Path to the current storage.
  • schema_node – Top-level schema node used for the stored data.
  • data – Top-level data node, providing access to all managed data.
class dsch.backends.npz.String(schema_node, parent, data_storage=None, new_params=None)

Bases: dsch.backends.npz._ItemNode

String-type data node for the npz backend.

replace(new_value)

Completely replace the current node value.

Instead of changing parts of the data (e.g. via numpy array slicing), replace the entire data object for this node.

Parameters:new_value – New value to apply to the node, independent of the backend in use.
class dsch.backends.npz.Time(schema_node, parent, data_storage=None, new_params=None)

Bases: dsch.data.Time, dsch.backends.npz._ItemNode

Time-type data node for the npz backend.

replace(new_value)

Completely replace the current node value.

Instead of changing parts of the data (e.g. via numpy array slicing), replace the entire data object for this node.

Parameters:new_value – New value to apply to the node, independent of the backend in use.