H5DataSet

H5DataSet

Representation of a dataset inside a HDF5 file.

Constructor

new H5DataSet(file, name, optionsopt)

Source:
Parameters:
Name Type Attributes Default Description
file string

Path to the HDF5 file.

name string

Name of the dataset inside the file.

options object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
load boolean <optional>
false

Whether or not to load the contents of the dataset in the constructor. If false, the contents can be loaded later with load.

Extends

Classes

H5DataSet

Members

attributes :Array

Source:
Overrides:

Array containing the names of all attributes of this object.

Type:
  • Array

file :string

Source:
Overrides:

Path to the HDF5 file.

Type:
  • string

(nullable) levels :Array

Source:

Levels of a HDF5 enum, to be indexed by the integer values. For non-enum data, this is set to null.

Type:
  • Array

loaded :boolean

Source:

Whether the contents of the dataset have already been loaded.

Type:
  • boolean

name :string

Source:
Overrides:

Name of the object inside the file.

Type:
  • string

shape :Array

Source:

Array of integers containing the dimensions of the dataset. If this is empty, the dataset is a scalar.

Type:
  • Array

type :object

Source:

String containing the type of the dataset. This may be "IntX" or "UintX" for X of 8, 16, 32, or 64; or "FloatX" for X of 32 or 64; "String", "Enum", or "Other".

Type:
  • object

values :Array|TypedArray

Source:

The contents of this dataset. This has length equal to the product of shape; unless this dataset is scalar, in which case it has length 1.

Type:
  • Array | TypedArray

Methods

load() → {Array|TypedArray}

Source:
Returns:

The contents of this dataset are loaded and cached in this H5DataSet object. A (Typed)Array is returned containing those contents.

Type
Array | TypedArray

readAttribute(attr) → {object}

Source:
Overrides:

Read an attribute of the object.

Parameters:
Name Type Description
attr string

Name of the attribute.

Returns:

Object containing the attribute values and the shape of the attribute. For HDF5 enums, an additional level property is present, containing the levels indexed by the integer values.

Type
object

write(x, optionsopt)

Source:
Parameters:
Name Type Attributes Default Description
x Array | TypedArray | number | string

Values to write to the dataset. This should be of length equal to the product of shape; unless shape is empty, in which case it should either be of length 1, or a single number or string.

options object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
cache boolean <optional>
false

Whether to cache the written values in this H5DataSet object.

Returns:

x is written to the dataset on file. No return value is provided.

writeAttribute(attr, type, shapenullable, x, optionsopt)

Source:
Overrides:

Write an attribute for the object.

Parameters:
Name Type Attributes Default Description
attr string

Name of the attribute.

type string

Type of dataset to create. This can be "IntX" or "UintX" for X of 8, 16, 32, or 64; or "FloatX" for X of 32 or 64; or "String"; or "Enum".

shape Array <nullable>

Array containing the dimensions of the dataset to create. If set to an empty array, this will create a scalar dataset. If set to null, this is determined from x.

x TypedArray | Array | string | number

Values to be written to the new dataset, see write. This should be of length equal to the product of shape; unless shape is empty, in which case it should either be of length 1, or a single number or string.

options object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
maxStringLength number <optional>
<nullable>
null

Maximum length of the strings to be saved. Only used when type = "String". If null, this is inferred from the maximum length of strings in x.

levels Array <optional>
<nullable>
null

Array of strings containing enum levels when type = "Enum". If supplied, x should be an array of integers that index into levels. Alternatively, levels may be null, in which case x should be an array of strings that is used to infer levels.