Skip to main content

HDF5 exporter plugin for vcti-tree-exporter: writes a vcti tree to an .h5 file (groups, datasets, attributes).

Project description

HDF5 Tree Exporter

HDF5 exporter plugin for vcti-tree-exporter: writes a vcti tree to an .h5 file (groups, datasets, attributes).

HdfExporter serializes any vcti-tree tree whose node payloads are vcti-datanode DataNodes to a single HDF5 file. It satisfies the vcti.tree.exporter.core.Exporter protocol and ships a get_exporter_descriptor() factory, so a consumer registers it in a catalog and resolves it by id ("hdf5") or by attribute lookup.

Installation

pip install vcti-tree-exporter-hdf5

This pulls in vcti-tree-exporter (the protocol/catalog) and h5py.

Tree → HDF5 mapping

Tree node HDF5 object
internal node (has children) HDF5 group
data leaf (node.load() yields an array) HDF5 dataset (plain or, for a structured array, compound)
metadata-only leaf (no data, no children) HDF5 group with attributes
a node's node.name the group/dataset name (falls back to node_<index>)
a node's node.attributes HDF5 attributes on the group/dataset

A node's structural name comes from node.name (the vcti-datanode intrinsic), and its free-form node.attributes are written verbatim — intrinsic identity lives in its own namespace, so nothing needs filtering. NumPy Unicode (U<n>) fields inside a compound dtype are stored as h5py variable-length UTF-8 strings (h5py has no fixed-width Unicode in compound types). Attribute values are coerced for h5py (bytes decoded, numpy scalars via .item()); anything h5py can't store natively falls back to its str().

Usage

from pathlib import Path
from vcti.tree.exporter.core import build_registry, get_exporter
from vcti.tree.exporter.hdf5 import get_exporter_descriptor

registry = build_registry([get_exporter_descriptor()])   # plus any other format plugins
get_exporter(registry, "hdf5").export(tree, Path("model.h5"), overwrite=True)

Or use the exporter directly:

from vcti.tree.exporter.hdf5 import HdfExporter
HdfExporter().export(tree, Path("model.h5"))

Dependencies

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vcti_tree_exporter_hdf5-2.0.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vcti_tree_exporter_hdf5-2.0.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file vcti_tree_exporter_hdf5-2.0.0.tar.gz.

File metadata

  • Download URL: vcti_tree_exporter_hdf5-2.0.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vcti_tree_exporter_hdf5-2.0.0.tar.gz
Algorithm Hash digest
SHA256 12f64fe7ae389198f91643a3462f7a4566e4d9e5c100d55062f5106ec0ca77ee
MD5 7a0e67738c5c3138b5a48e5a16f5e626
BLAKE2b-256 033d3b22948c6b9a9c540ddcadeb7d06ec015bb2116785d186b5e485ce0fa259

See more details on using hashes here.

Provenance

The following attestation bundles were made for vcti_tree_exporter_hdf5-2.0.0.tar.gz:

Publisher: release.yml on vcollab/vcti-python-tree-exporter-hdf5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vcti_tree_exporter_hdf5-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vcti_tree_exporter_hdf5-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8df45c7216793e65cd7dd787b69e77a1b8c492121c41b014a0111a61423351a
MD5 65084c481adcc44c978412e19c507229
BLAKE2b-256 1aff8d804edb5ad10def627bf074ce4167530ba461555035ccdf20e34d0797f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for vcti_tree_exporter_hdf5-2.0.0-py3-none-any.whl:

Publisher: release.yml on vcollab/vcti-python-tree-exporter-hdf5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page