Skip to main content

NPZ Tree Exporter

NPZ exporter plugin for vcti-tree-exporter: writes a vcti tree to a single .npz archive.

NpzExporter serializes any vcti-tree tree whose node payloads are vcti-datanode DataNodes to one NumPy .npz archive, and ships a get_exporter_descriptor() factory so a consumer registers it in a catalog and resolves it by id ("npz") or by attribute lookup.

NPZ preserves array dtype and shape natively, so it suits complete numeric simulation data — the heavy arrays JSON and CSV handle poorly.

Tree → NPZ mapping

The archive is self-contained:

  • each data leaf's array is stored under a path key built from node names, e.g. model/materials/material_0, so the flat NPZ namespace still reads as the tree (duplicate paths are de-collided with a ~N suffix);
  • the hierarchy, each node's attributes, and the array key of every data node are stored as one JSON manifest under the reserved key __manifest__.
import numpy as np, json
archive = np.load("model.npz")
manifest = json.loads(str(archive["__manifest__"]))   # the tree structure + attributes
array = archive["model/materials/material_0"]          # a leaf's array, native dtype

A node may carry both an array and children. Attribute values are JSON-encoded into the manifest (bytes decoded, numpy scalars/arrays converted) with a str() fallback. The export is one-way — there is no matching importer.

Usage

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

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

Or use the exporter directly:

from vcti.tree.exporter.npz import NpzExporter
NpzExporter().export(tree, Path("model.npz"))

Dependencies

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_npz-2.0.0.tar.gz (7.6 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_npz-2.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vcti_tree_exporter_npz-2.0.0.tar.gz
  • Upload date:
  • Size: 7.6 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_npz-2.0.0.tar.gz
Algorithm Hash digest
SHA256 beb0be6ef1cc6964b374814df1edc74e3338322bfccd576078fac7f8943c41e7
MD5 96dafd1384a7e931540a7fb4ca76b9f1
BLAKE2b-256 988dedb19ab1bc125c974823f6085094ab5b3c455030611759bc088c0e84b884

See more details on using hashes here.

Provenance

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

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

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_npz-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vcti_tree_exporter_npz-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d12ad414d83f765718e05bf41eb15e12a680e95557e68c1f968297a7cac077cb
MD5 ae4bd664aba2bd4aee4403a8c9caeb98
BLAKE2b-256 a947e8ec03d724b0bd47971f0ee0683084496a8e8e2e0d744b8d8357efcd1e1b

See more details on using hashes here.

Provenance

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

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

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

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 files

Supported by

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