ndtbl
Pure-Python tools for reading, writing, inspecting, and generating .ndtbl
files without depending on the C++ binaries.
The package is useful when you want to:
- inspect an existing table on a machine without the C++ toolchain
- generate small synthetic tables for tests, examples, and development
- query one concrete grid point from the command line
- read or write
.ndtblfiles directly from Python workflows using NumPy arrays
🔧 Features
- Read
.ndtblmetadata or full payloads - Write
.ndtblfiles compatible with the current C++ implementation - Inspect files from the command line with metadata and sample values
- Query one point in a table by zero-based grid indices
- Generate small predefined linear tables for development workflows
⚙️ Installation
Install from the package directory:
python -m pip install .
Or install from PyPI:
python -m pip install ndtbl
For development:
python -m pip install -v -e .[lint,tests]
🐍 Python API
The core API revolves around FieldGroup, UniformAxis, ExplicitAxis, read_group, and write_group.
import numpy as np
from ndtbl import FieldGroup, UniformAxis, ExplicitAxis, read_group, write_group
group = FieldGroup(
axes=(ExplicitAxis([0.0, 0.1, 1.0]), UniformAxis(10.0, 20.0, 2)),
field_names=("A", "B"),
values=np.array(
[
[[1.0, 10.0], [2.0, 20.0]],
[[3.0, 30.0], [4.0, 40.0]],
[[5.0, 50.0], [6.0, 60.0]],
],
dtype=np.float64,
),
)
write_group("example.ndtbl", group)
loaded = read_group("example.ndtbl")
print(loaded.field_names)
print(loaded.values[1, 0, :])
write_group refuses to write files larger than 128 MiB by default. Pass
max_size_mib=... when a larger output is intentional.
The values array shape is axis_0 x axis_1 x ... x field.
Demo notebook
Use the demo notebook to test the Python functionality of ndtbl and see how it can be used to read and write binary .ndtbl files.
💻 CLI
The package installs one executable, ndtbl, with three subcommands:
inspectprints metadata and a configurable number of sample valuesqueryprints the field values at one point addressed by zero-based indicesgeneratecreates a simple synthetic table with linear fields
Show the top-level help:
ndtbl --help
inspect
Inspect an existing file:
ndtbl inspect example.ndtbl
Limit the number of printed sample points:
ndtbl inspect example.ndtbl --samples 3
query
Query one point in the table using zero-based indices in axis order:
ndtbl query example.ndtbl 1 0
Print metadata before the queried values:
ndtbl query --metadata example.ndtbl 1 0
For a 3D table, provide three indices:
ndtbl query example-3d.ndtbl 1 2 0
generate
Generate a small linear table:
ndtbl generate output.ndtbl \
--axis 0 1 3 \
--axis 10 20 2 \
--field-linear A 1.0 2.0 0.0 \
--field-linear B 5.0 0.0 -1.0
Use float32 output instead of the default float64:
ndtbl generate output.ndtbl \
--axis 0 1 3 \
--field-linear A 1.0 2.0 \
--dtype float32
Raise or lower the generation safety limit:
ndtbl generate output.ndtbl \
--axis 0 1 100 \
--axis 0 1 100 \
--field-linear A 0.0 1.0 1.0 \
--max-size-mib 32
--field-linear expects NAME OFFSET C0 [C1 ...], with one coefficient per
axis in storage order.
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 ndtbl-0.3.0.tar.gz.
File metadata
- Download URL: ndtbl-0.3.0.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ce8d87618292d703be6a419f56d393715075459509010c08f32dcd5a0ce9880
|
|
| MD5 |
5317709ca0055374163194c6222910c1
|
|
| BLAKE2b-256 |
8930e6f5df47bd6b9b7c6d745afbaee2f875075d3cf771615fa4719e0de85b15
|
File details
Details for the file ndtbl-0.3.0-py3-none-any.whl.
File metadata
- Download URL: ndtbl-0.3.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d07389616feb7721dd5554b9bddc57653665be47864aaca35b17057dafe0467
|
|
| MD5 |
2611d4fe3ed5ddf8f1e695c4d71109ff
|
|
| BLAKE2b-256 |
0dc38affd6e7f53991a9d5bdd363be6d104eb88451dfcc88048cb58b3bb76ca2
|