MemDatasetCommon#

class caput.memdata.MemDatasetCommon(shape, dtype, chunks=None, compression=None, compression_opts=None, **kwargs)[source]#

Bases: MemDataset

In memory implementation of h5py.Dataset.

Inherits from MemDataset. Encapsulates a numpy array mocked up to look like an hdf5 dataset. Similar to h5py datasets, this implements slicing like a numpy array but as it is not actually a many operations won’t work (e.g. ufuncs).

Parameters:
shapetuple[int, …]

Shape of array to initialise.

dtypedtype

Type of array to create.

chunkstuple[int, …]

Chunk sizes. If None, dataset is not chunked.

compressionstr | int | None

Name or identifier of HDF5 or Zarr compression filter.

compression_optsdict | None

See HDF5 and Zarr documentation for compression filters. Compression options for the dataset.

**kwargsAny

Arbitrary keyword arguments passed to MemDataset constructor.

property chunks[source]#

Access the data chunking information.

property comm[source]#

Reference to the MPI communicator.

property common[source]#

Assert that this is a common dataset.

property compression[source]#

Access the compression information.

property compression_opts[source]#

Access the compression options.

property data[source]#

Access the underlying data array.

property distributed[source]#

Assert that this is not a distributed dataset.

property dtype[source]#

Access the data type.

property local_data[source]#

Access the underlying data array.

property shape[source]#

Access the shape of the underlying array.

Methods#

__getitem__(obj)

Index directly into the data array.

__setitem__(obj, val)

Index directly into the data array and set values at that location.

from_numpy_array(data[, chunks, compression, ...])

Initialise from a numpy array.