No project description provided
Project description
Python bindings for Open Meteo file format
Note: This package is currently under active development and not yet ready for production use. APIs may change without notice until the first stable release.
Features
- Fast reading and writing of multi-dimensional arrays
- Hierarchical data structure support
- Integration with NumPy arrays
- Chunked data access for efficient I/O
- Support for fsspec and xarray
Basic Reading
OM files are structured like a tree of variables. The following example assumes that the file test_file.om contains an array variable as a root variable which has a dimensionality greater than 2 and a size of at least 2x100:
from omfiles import OmFilePyReader
reader = OmFilePyReader("test_file.om")
data = reader[0:2, 0:100, ...]
Writing Arrays
Simple Array
import numpy as np
from omfiles import OmFilePyWriter
# Create sample data
data = np.random.rand(100, 100).astype(np.float32)
# Initialize writer
writer = OmFilePyWriter("simple.om")
# Write array with compression
variable = writer.write_array(
data,
chunks=[50, 50],
scale_factor=1.0,
add_offset=0.0,
compression="pfor_delta_2d",
name="data"
)
# Finalize the file. This writes the trailer and flushes the buffers.
writer.close(variable)
Hierarchical Structure
import numpy as np
from omfiles import OmFilePyWriter
# Create sample data
features = np.random.rand(1000, 64).astype(np.float32)
labels = np.random.randint(0, 10, size=(1000,), dtype=np.int32)
# Initialize writer
writer = OmFilePyWriter("hierarchical.om")
# Write child arrays first
features_var = writer.write_array(
features,
chunks=[100, 64],
name="features",
compression="pfor_delta_2d"
)
labels_var = writer.write_array(
labels,
chunks=[100],
name="labels"
)
metadata_var = writer.write_scalar(
42,
name="metadata"
)
# Create root group with children
root_var = writer.write_scalar(
0, # This is just placeholder data, later we will support creating groups with no data
name="root",
children=[features_var, labels_var, metadata_var]
)
# Finalize the file
writer.close(root_var)
Development
# setup python virtual environment with pyenv
python -m venv .venv
source .venv/bin/activate
# To always activate this environment in this directory run `pyenv local pyo3`
pip install maturin
maturin develop --extras=dev
# if you encounter an error: Both VIRTUAL_ENV and CONDA_PREFIX are set. Please unset one of them
unset CONDA_PREFIX
Tests
cargo test --no-default-features
Benchmarks
Before running the benchmarks, make sure to compile the release version of the library:
maturin develop --release
Then run the benchmarks:
python benchmarks/main.py
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 Distributions
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 omfiles-0.0.1.tar.gz.
File metadata
- Download URL: omfiles-0.0.1.tar.gz
- Upload date:
- Size: 33.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fa132388412d424cd8ede2fb86ce4a3cd4e289245978e266999b13abd31f0ae
|
|
| MD5 |
3b2c44c9425474edc1b11ce7c67bd5d6
|
|
| BLAKE2b-256 |
b9b08dd8e83af3dcbaddff0a2501cb405b45f6777b052eae08d9120547d8e0a3
|
File details
Details for the file omfiles-0.0.1-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: omfiles-0.0.1-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 592.5 kB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
026698dcb6a353f732d67c3a35c985f894f850c8950aea5decab76a8e8451d0b
|
|
| MD5 |
c7820423f912df03b5bce23128f8c147
|
|
| BLAKE2b-256 |
29568cceb9594fb4247abfb68cedc04d01fb8bad68de2b930ca7b28badfc80b1
|
File details
Details for the file omfiles-0.0.1-cp38-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: omfiles-0.0.1-cp38-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 974.5 kB
- Tags: CPython 3.8+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4ce18addd0f60ddcc5ffcddc51f6662d2996b8ba54e3d19c4394078d841720b
|
|
| MD5 |
441b96b7f7b0e46ab6abd27cf4141f53
|
|
| BLAKE2b-256 |
10ed860b2920ab9ac1b1eadbc7083f9ad5c452a015b7fecf0eba4efdd9a88fb0
|
File details
Details for the file omfiles-0.0.1-cp38-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: omfiles-0.0.1-cp38-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 769.6 kB
- Tags: CPython 3.8+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
321254a3df549f98debc6b6fdc1dbefd65a17dd571b721af295b657deb2dbab6
|
|
| MD5 |
46975261c6a1794f22d893f6411a6e32
|
|
| BLAKE2b-256 |
913b722d9cb51b9a83cb8d38cd7d0c843b4d0b2c8120ae473e2cdc02a955bba7
|
File details
Details for the file omfiles-0.0.1-cp38-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: omfiles-0.0.1-cp38-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 956.6 kB
- Tags: CPython 3.8+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caaa00150c7c677908535e39b8bb262bf727994e7a2dd3e51b3edf962fdf0c02
|
|
| MD5 |
3f540f1dcd73a533697bc493163850ab
|
|
| BLAKE2b-256 |
b64305421feaf6c770d3b12a226156e151613bd6d7a8ddad688a35e025eea0d2
|
File details
Details for the file omfiles-0.0.1-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: omfiles-0.0.1-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 716.7 kB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0416ec104c1efe5a022924083364360a74da11ff43e37fb931ff9c5df2b9615
|
|
| MD5 |
722bd953307fa659b63d06ad33f2ac08
|
|
| BLAKE2b-256 |
fd2fa287a3dc2408dde5162ef8132296fbeab6735c149a3cb8b1ec9a3f17abb7
|
File details
Details for the file omfiles-0.0.1-cp38-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: omfiles-0.0.1-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 689.7 kB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fba75a4ac79590e56e1c0e2f328cbccbaaba664465fcfa0a2deaf3e7956733b
|
|
| MD5 |
9dea7fa09e62c9421cc82e6aaeae54e1
|
|
| BLAKE2b-256 |
ad785e19832ca07cca77ac3ebb8aac78e5ff1528a4da93d7c023050ea7752a9b
|