Command-line HDF5 processor
Project description
hdfq
hdfq is a CLI tool for displaying and manipulating hdf5 files.
It uses syntax similar to jq although it does not yet support everything jq does.
hdfq is written in Python.
Installation
with pipx
The recommended way of installing hdfq is trough the pipx installer :
pipx install hdfq
hdfq will be installed in an isolated environment but will be available globally as a shell application.
from source
You can download the source code from gitlab with :
git clone git@github.com:MatteoBouvier/hdfq.git
Usage
Basics
hdfq requires both a filter (a command to be evaluated) and a path to a file saved in hdf5 format.
A typical hdfq command would look like :
hdfq "." path/to/hdf5/file
👆 Tip : you can also invoke hdfq as :
echo path/to/hdf5/file | hdfq "."
The filter argument can be used to :
- read a specific object (stored under the
<name>identifier) from the file with.<name> - read a specific attribute from an object with
#<attr_name> - get the list of identifiers with
keys, attributes withattrsand attribute identifiers withkattrs - set an object's value with
<object>=<value> - delete an object with
del(<object>)
Commands can be chained in the filter argument using a | symbol.
Examples
View all contents in a file :
hdfq '.' file.h5
Read the contents of an object named b in a
hdfq '.a.b' file.h5
Read the z attribute of an object's (a.b) :
hdfq '.a.b#z' file.h5
Chain commands (select a.b and ...):
# list keys
hdfq '.a.b | keys' file.h5
# list attribute names
hdfq '.a.b | kattrs' file.h5
# list attribute key-value pairs
hdfq '.a.b | attrs' file.h5
Update an object's value :
hdfq '.a#version = 2' file.h5
Delete an object :
hdfq 'del(.obj)' file.h5
List object sizes (and compute total) in a group :
hdfq '.a | sizes' file.h5
Create a dataset :
# create a dataset from values
hdfq '.a = [1,2,3]' file.h5
# create a 10 x 10 matrix filled with ones
hdfq '.a = [1](10, 10)' file.h5
# specify the data type
hdfq '.a = [1,2,3]<float64>' file.h5
# create an empty dataset with shape (3, 4)
hdfq '.a = [](3, 4)' file.h5
# specify additional parameters of h5 datasets
hdfq '.a = [1,2,3, chunks=True, maxshape=(100, 100)]' file.h5
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 hdfq-0.4.2.tar.gz.
File metadata
- Download URL: hdfq-0.4.2.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdf7231091678013440c79d8b89fe5ed41828f1f2c578d6471fb3e8828530ad3
|
|
| MD5 |
fc2083520fcf62631588c1bfa0a2e64f
|
|
| BLAKE2b-256 |
1125befed3f40872c0aef72fb2cf1f23618e661d1047de8f3547a55bdc0b53c4
|
File details
Details for the file hdfq-0.4.2-py3-none-any.whl.
File metadata
- Download URL: hdfq-0.4.2-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75f3b3a94a1b02094e1d7826e3e55db581f89c781ea799953b0c04a7c31ad447
|
|
| MD5 |
ff2831987af3592d5175e89110fce1b7
|
|
| BLAKE2b-256 |
0e55752be5d035e19d78988913aec6c7b2ac2f2c8fef0579609955406d018526
|