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.
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_datasetsReturn a dictionary of ancillary datasets attached to this dataset.
attrsExact copy of parent class: Attributes attached to this object
basenameBasename of the dataset, which is the name without the internal file path
chunksDataset chunks (or None)
compressionCompression strategy (or None)
compression_optsCompression setting.
conventionReturn the convention currently enabled.
coordsReturn a dictionary of the dimension scales of the dataset.
dimsAccess dimension scales attached to this dataset.
dtypeNumpy dtype representing the datatype
externalExternal file settings.
fileReturn a File instance associated with this object
fillvalueFill value for this dataset (0 by default)
fletcher32Fletcher32 filter is present (T/F)
hdf_filenameThe filename of the file, even if the HDF5 file is closed.
idLow-level identifier appropriate for this object
iriDeprecated.
is_scaleReturn
Trueif this dataset is also a dimension scale.is_virtualCheck if this is a virtual dataset
maxshapeShape up to which this dataset can be resized.
nameReturn the full name of this object.
nbytesNumpy-style attribute giving the raw dataset size as the number of bytes
ndimNumpy-style attribute giving the number of dimensions
parentReturn the parent group of this dataset
rdfReturn RDF Manager
refAn (opaque) HDF5 reference to this object
regionrefCreate a region reference (Datasets only).
rootparentReturn the root group of the file.
scaleoffsetScale/offset filter settings.
shapeNumpy-style shape tuple giving dataset dimensions
shuffleShuffle filter present (T/F)
sizeNumpy-style attribute giving the total dataset size
standard_attributesReturn the standard attributes of the class.
valuesMimic the h5py behaviour and return a numpy array instead of a xarray object.