require_dataset#

caput.memdata._BaseGroup.require_dataset(name, shape, dtype, **kwargs)[source]#

Require a dataset to exist, create if it doesn’t.

All arguments are passed through to create_dataset.

Parameters:
namestr

Dataset name.

shapetuple

Shape tuple.

dtypedtype

numpy dtype of the dataset.

**kwargsAny

Arbitrary keyword arguments use if a new dataset is created.

Returns:
datasetDatasetLike

The requested dataset, or a new dataset if the requested one did not exist.

Raises:
TypeError

If an object with the requested name exists but it is not a Dataset.