h5rdmtoolbox.wrapper.core.Dataset

h5rdmtoolbox.wrapper.core.Dataset#

class h5rdmtoolbox.wrapper.core.Dataset(_id)[source]#

Wrapper around the h5py.Dataset. Some useful methods are added on top of the underlying h5py package.

Note

All features from h5py packages are preserved.

Notes

The following methods are added to the h5py.Dataset object:

  • attach_ancillary_dataset(): Associate a dataset to the current dataset.

  • attach_data_scale_and_offset(): Attach data scale and offset to the current dataset.

  • detach_data_offset(): Detach data offset from the current dataset.

  • detach_data_scale(): Detach data scale from the current dataset.

  • coords(): Return the coordinates of the current dataset similar to xarray.

  • dump(): Outputs xarray-inspired _html representation of the file content if a notebook environment is used.

  • dumps(): string representation of group

  • isel(): Select data by named dimension and index, mimics xarray.isel.

  • sel(): Select data by named dimension and values, mimics xarray.sel.

The following properties are added to the h5py.Dataset object:

  • rootparent: The root group of the file.

  • basename: The basename of the dataset.

  • values: Accessor to return numpy array of the dataset.

__init__(_id)[source]#

Create a new Dataset object by binding to a low-level DatasetID.

Methods

__init__(_id)

Create a new Dataset object by binding to a low-level DatasetID.

assign_coord(coord)

asstr([encoding, errors])

Get a wrapper to read string data as Python strings:

astype(dtype)

Get a wrapper allowing you to perform reads to a different destination type, e.g.:

attach_ancillary_dataset(ancillary_dataset)

Attach a flag dataset to the current dataset.

attach_data_scale_and_offset(scale, offset)

Attach a data scale and offset to this dataset.

detach_data_offset()

Remove the attached data offset dataset from this dataset.

detach_data_scale()

Remove the attached data scale dataset from this dataset.

dump()

Call sdump()

dumps()

Print the dataset content in a more comprehensive way

fields(names, *[, _prior_dtype])

Get a wrapper to read a subset of fields from a compound data type:

flush()

Flush the dataset data and metadata to the file.

get_data_offset()

Return the data offset dataset if attached to this dataset.

get_data_scale()

Return the data scale dataset if attached to this dataset.

isel(**indexers)

Index selection by providing the coordinate name.

iter_chunks([sel])

Return chunk iterator.

len()

The size of the first axis.

make_scale([name])

Make this dataset an HDF5 dimension scale.

read_direct(dest[, source_sel, dest_sel])

Read data directly from HDF5 into an existing NumPy array.

refresh()

Refresh the dataset metadata by reloading from the file.

resize(size[, axis])

Resize the dataset, or the specified axis.

sdump()

Print the dataset content in a more comprehensive way

sel([method])

Select data based on coordinates and specific value(s).

set_primary_scale(axis, iscale)

Set the primary scale for a specific axis.

virtual_sources()

Get a list of the data mappings for a virtual dataset

write_direct(source[, source_sel, dest_sel])

Write data directly to HDF5 from a NumPy array.

Attributes

ancillary_datasets

Return a dictionary of ancillary datasets attached to this dataset.

attrs

Exact copy of parent class: Attributes attached to this object

basename

Basename of the dataset, which is the name without the internal file path

chunks

Dataset chunks (or None)

compression

Compression strategy (or None)

compression_opts

Compression setting.

convention

Return the convention currently enabled.

coords

Return a dictionary of the dimension scales of the dataset.

dims

Access dimension scales attached to this dataset.

dtype

Numpy dtype representing the datatype

external

External file settings.

file

Return a File instance associated with this object

fillvalue

Fill value for this dataset (0 by default)

filter_ids

Numeric IDs of HDF5 filters used for this dataset

filter_names

Names, as stored in the file, of the filters used for this dataset

fletcher32

Fletcher32 filter is present (T/F)

hdf_filename

The filename of the file, even if the HDF5 file is closed.

id

Low-level identifier appropriate for this object

iri

Deprecated.

is_scale

Return True if this dataset is also a dimension scale.

is_virtual

Check if this is a virtual dataset

maxshape

Shape up to which this dataset can be resized.

name

Return the full name of this object.

nbytes

Numpy-style attribute giving the raw dataset size as the number of bytes

ndim

Numpy-style attribute giving the number of dimensions

parent

Return the parent group of this dataset

rdf

Return RDF Manager

ref

An (opaque) HDF5 reference to this object

regionref

Create a region reference (Datasets only).

rootparent

Return the root group of the file.

scaleoffset

Scale/offset filter settings.

shape

Numpy-style shape tuple giving dataset dimensions

shuffle

Shuffle filter present (T/F)

size

Numpy-style attribute giving the total dataset size

standard_attributes

Return the standard attributes of the class.

values

Mimic the h5py behaviour and return a numpy array instead of a xarray object.