Dataset

class bth5.Dataset(filename, path, mode='r', value_dtype=None)[source]

Represents a bitemporal dataset as a memory-mapped structure stored in HDF5.

Examples

>>> ds = bth5.Dataset(temp_h5, '/path/to/group', mode='a', value_dtype=np.float64)
>>> with ds:
...     ds.write(np.datetime64("2018-06-21 12:26:47"), 2.0)
>>> # Write happens here.
>>> with ds:
...     ds.valid_times[:]
array([(0, '2018-06-21T12:26:47.000000', 2.)],
      dtype=[('transaction_id', '<u8'), ('valid_time', '<M8[us]'), ('value', '<f8')])

Attributes

Dataset.dtype

The dtype of this dataset.

Dataset.file_dtype

The dtype stored in the file.

Methods

Dataset.__init__(filename, path[, mode, …])

Creates a Dataset.

Dataset.close()

Close the current file handle.

Dataset.interpolate_values(interp_times)

Interpolates the values at the given valid times.

Dataset.open([mode])

Opens the file for various operations

Dataset.write(valid_time, value)

Appends data to a dataset.

Indexers

Dataset.records

Index into the dataset by record ID.

Dataset.transaction_times

Index into the transaction index by transaction time.

Dataset.transactions

Index into the transaction index by transaction ID.

Dataset.transaction_idx

Indexes into the dataset by transaction ID.

Dataset.valid_times

Indexes into the dataset by valid time.