NPZ exporter plugin for vcti-tree-exporter: writes a vcti tree to a single .npz archive (arrays under path-keyed entries, hierarchy and attributes in an embedded JSON manifest).
Project description
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~Nsuffix); - 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
- vcti-tree-exporter — the
Exporterprotocol and theExporterDescriptorcatalog. - vcti-tree / vcti-datanode — the tree and payload types.
- numpy — the
.npzbackend.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
beb0be6ef1cc6964b374814df1edc74e3338322bfccd576078fac7f8943c41e7
|
|
| MD5 |
96dafd1384a7e931540a7fb4ca76b9f1
|
|
| BLAKE2b-256 |
988dedb19ab1bc125c974823f6085094ab5b3c455030611759bc088c0e84b884
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_tree_exporter_npz-2.0.0.tar.gz -
Subject digest:
beb0be6ef1cc6964b374814df1edc74e3338322bfccd576078fac7f8943c41e7 - Sigstore transparency entry: 1983060346
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-tree-exporter-npz@8f82640a7b1f1f6b59dfaa975ac5579d533af802 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8f82640a7b1f1f6b59dfaa975ac5579d533af802 -
Trigger Event:
push
-
Statement type:
File details
Details for the file vcti_tree_exporter_npz-2.0.0-py3-none-any.whl.
File metadata
- Download URL: vcti_tree_exporter_npz-2.0.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d12ad414d83f765718e05bf41eb15e12a680e95557e68c1f968297a7cac077cb
|
|
| MD5 |
ae4bd664aba2bd4aee4403a8c9caeb98
|
|
| BLAKE2b-256 |
a947e8ec03d724b0bd47971f0ee0683084496a8e8e2e0d744b8d8357efcd1e1b
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_tree_exporter_npz-2.0.0-py3-none-any.whl -
Subject digest:
d12ad414d83f765718e05bf41eb15e12a680e95557e68c1f968297a7cac077cb - Sigstore transparency entry: 1983060411
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-tree-exporter-npz@8f82640a7b1f1f6b59dfaa975ac5579d533af802 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8f82640a7b1f1f6b59dfaa975ac5579d533af802 -
Trigger Event:
push
-
Statement type: