Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
Unreleased
----------

- Compression filters and libraries:

* Added **Terse** filter: `TERSE/PROLIX (TRPX) v2.0 <https://github.com/senikm/trpx2.0>`_ (commit 93cf8e4)

- Build:

* Added support of C++20 compile flag handling for filter extensions (previously only for static libraries)

7.1.0: 01/09/02026
------------------

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ hdf5plugin
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.7257761.svg
:target: https://doi.org/10.5281/zenodo.7257761

*hdf5plugin* provides `HDF5 compression filters <https://github.com/HDFGroup/hdf5_plugins/blob/master/docs/RegisteredFilterPlugins.md#list-of-filters-registered-with-the-hdf-group>`_ (namely: Blosc, Blosc2, BitShuffle, BZip2, Htj2k, FciDecomp, LZ4, Sperr, SZ, SZ3, Zfp, ZStd) and makes them usable from `h5py <https://www.h5py.org>`_.
*hdf5plugin* provides `HDF5 compression filters <https://github.com/HDFGroup/hdf5_plugins/blob/master/docs/RegisteredFilterPlugins.md#list-of-filters-registered-with-the-hdf-group>`_ (namely: Blosc, Blosc2, BitShuffle, BZip2, Htj2k, FciDecomp, LZ4, Sperr, SZ, SZ3, TERSE/PROLIX, Zfp, ZStd) and makes them usable from `h5py <https://www.h5py.org>`_.

See `documentation <http://www.silx.org/doc/hdf5plugin/latest/>`_.

Expand Down
14 changes: 14 additions & 0 deletions doc/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,20 @@ compression_opts:
- **psnr high** (big endian float64)
- **psnr low**

terse
.....

No options can be provided by the user, but the filter stores the following ``cd_values``:

- **type_code**: Code of the dataset's integer data type:

* 0: int16
* 1: uint16
* 2: int32
* 3: uint32
* 4: int8
* 5: uint8

zfp
...

Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
hdf5plugin
==========

*hdf5plugin* provides `HDF5 compression filters <https://github.com/HDFGroup/hdf5_plugins/blob/master/docs/RegisteredFilterPlugins.md#list-of-filters-registered-with-the-hdf-group>`_ (namely: Blosc, Blosc2, BitShuffle, BZip2, FciDecomp, Htj2k, LZ4, Sperr, SZ, SZ3, Zfp, ZStd) and makes them usable from `h5py <https://www.h5py.org>`_.
*hdf5plugin* provides `HDF5 compression filters <https://github.com/HDFGroup/hdf5_plugins/blob/master/docs/RegisteredFilterPlugins.md#list-of-filters-registered-with-the-hdf-group>`_ (namely: Blosc, Blosc2, BitShuffle, BZip2, FciDecomp, Htj2k, LZ4, Sperr, SZ, SZ3, TERSE/PROLIX, Zfp, ZStd) and makes them usable from `h5py <https://www.h5py.org>`_.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the class name as filter name in the filter lists:

Suggested change
*hdf5plugin* provides `HDF5 compression filters <https://github.com/HDFGroup/hdf5_plugins/blob/master/docs/RegisteredFilterPlugins.md#list-of-filters-registered-with-the-hdf-group>`_ (namely: Blosc, Blosc2, BitShuffle, BZip2, FciDecomp, Htj2k, LZ4, Sperr, SZ, SZ3, TERSE/PROLIX, Zfp, ZStd) and makes them usable from `h5py <https://www.h5py.org>`_.
*hdf5plugin* provides `HDF5 compression filters <https://github.com/HDFGroup/hdf5_plugins/blob/master/docs/RegisteredFilterPlugins.md#list-of-filters-registered-with-the-hdf-group>`_ (namely: Blosc, Blosc2, BitShuffle, BZip2, FciDecomp, Htj2k, LZ4, Sperr, SZ, SZ3, Terse, Zfp, ZStd) and makes them usable from `h5py <https://www.h5py.org>`_.



* Supported operating systems: Linux, Windows, macOS.
Expand Down
3 changes: 3 additions & 0 deletions doc/information.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ HDF5 compression filters and compression libraries sources were obtained from:
* `SZ3 plugin <https://github.com/szcompressor/SZ3>`_
(commit `4bbe9df7e4bcb <https://github.com/szcompressor/SZ3/commit/4bbe9df7e4bcb6ae6339fcb3033100da07fe7434>`_)
using `SZ3 <https://github.com/szcompressor/SZ3>`_ and ZStd.
* `TERSE/PROLIX (TRPX v2.0) plugin <https://github.com/senikm/trpx2.0>`_

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hdf5 registered filters list points to the https://github.com/Senikm/trpx repo rather than trpx2.0.
See https://github.com/HDFGroup/hdf5_plugins/blob/master/docs/RegisteredFilterPlugins.md#terseprolix-trpx-

It would be best to see with upstream and the hdf group to update the link to the new repo. This projects aims at embedding official versions of the different filters.

Does trpx2.0 reads data compressed with trpx? If it is not the case, this should be advertised in the Terse class docstring.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the library is meant to also read trpx v1 files but i found a small bug and created a merge request for that in their repo: senikm/trpx2.0#12

i've also asked them by email to update the link to trpx2.0

(commit `93cf8e4 <https://github.com/senikm/trpx2.0/tree/93cf8e4b7e832da3e318e9d37d73f70e3ce08eeb>`_).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind checking with upstream if they can tag a version rather than referencing a commit hash?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've send a request to the upstream authors by email!

* `HDF5-ZFP plugin <https://github.com/LLNL/H5Z-ZFP>`_ (v1.1.1) using ZFP.
* `ZStd plugin <https://github.com/HDFGroup/hdf5_plugins/tree/master/ZSTD>`_
(commit `5573db8 <https://github.com/HDFGroup/hdf5_plugins/tree/5573db8f9706e1df262752a9247e90a3d4bd57bd/ZSTD>`_) using ZStd.
Expand Down Expand Up @@ -120,6 +122,7 @@ Please read the different licenses:
* SPERR: `lib/H5Z-SPERR/LICENSE <https://github.com/silx-kit/hdf5plugin/blob/main/lib/H5Z-SPERR/LICENSE>`_ and `lib/SPERR/LICENSE <https://github.com/silx-kit/hdf5plugin/blob/main/lib/SPERR/LICENSE>`_
* SZ: `lib/SZ/copyright-and-BSD-license.txt <https://github.com/silx-kit/hdf5plugin/blob/main/lib/SZ/copyright-and-BSD-license.txt>`_
* SZ3: `lib/SZ3/copyright-and-BSD-license.txt <https://github.com/silx-kit/hdf5plugin/blob/main/lib/SZ3/copyright-and-BSD-license.txt>`_
* TERSE/PROLIX: `lib/trpx2.0/LICENSE <https://github.com/silx-kit/hdf5plugin/blob/main/lib/trpx2.0/LICENSE>`_
* zfp: `lib/H5Z-ZFP/LICENSE <https://github.com/silx-kit/hdf5plugin/blob/main/lib/H5Z-ZFP/LICENSE>`_
* zstd: `lib/HDF5Plugin-Zstandard/LICENSE <https://github.com/silx-kit/hdf5plugin/blob/main/lib/HDF5Plugin-Zstandard/LICENSE>`_

Expand Down
10 changes: 9 additions & 1 deletion doc/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ As for reading compressed datasets, ``import hdf5plugin`` is required to enable

To create a compressed dataset use `h5py.Group.create_dataset`_ and set the ``compression`` and ``compression_opts`` arguments.

``hdf5plugin`` provides helpers to prepare those compression options: `Bitshuffle`_, `Blosc`_, `Blosc2`_, `BZip2`_, `FciDecomp`_, `Htj2k`_, `LZ4`_, `Sperr`_, `SZ`_, `SZ3`_, `Zfp`_, `Zstd`_.
``hdf5plugin`` provides helpers to prepare those compression options: `Bitshuffle`_, `Blosc`_, `Blosc2`_, `BZip2`_, `FciDecomp`_, `Htj2k`_, `LZ4`_, `Sperr`_, `SZ`_, `SZ3`_, `Terse`_, `Zfp`_, `Zstd`_.

Sample code:

Expand Down Expand Up @@ -133,6 +133,14 @@ SZ3
:inherited-members: FilterRefBase, Mapping
:undoc-members:

Terse
=====

.. autoclass:: Terse
:members:
:inherited-members: FilterRefBase, Mapping
:undoc-members:

Zfp
===

Expand Down
41 changes: 41 additions & 0 deletions lib/trpx2.0/.github/workflows/asan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: AddressSanitizer

on:
push:
pull_request:

jobs:
# Builds the pyterse extension with AddressSanitizer and UBSan and runs the
# Python tests against it.
pyterse-asan:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: python -m pip install --upgrade pip numpy pybind11
- name: Configure
run: >
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
-DBUILD_TERSECODEC=OFF
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer -g"
-DPython_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"
-Dpybind11_DIR="$(python -m pybind11 --cmakedir)"
- name: Build
run: cmake --build build
- name: Test
# The Python interpreter is not instrumented, so the ASan runtime has to be preloaded.
# libstdc++ is preloaded as well so that ASan can intercept __cxa_throw, which
# Python itself does not link.
# Leak detection is off because CPython and NumPy report leaks at exit.
env:
ASAN_OPTIONS: detect_leaks=0:abort_on_error=1
UBSAN_OPTIONS: print_stacktrace=1
run: |
export LD_PRELOAD="$(gcc -print-file-name=libasan.so) $(gcc -print-file-name=libstdc++.so)"
export PYTHONPATH="$PWD/build/pyterse"
python py_tests/pyterse_test.py -v
57 changes: 57 additions & 0 deletions lib/trpx2.0/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build

on:
push:
pull_request:

jobs:
# Builds tests/build_test.cpp with the compilers of the runner images and
# runs it.
posix:
name: ${{ matrix.os }} ${{ matrix.cxx }} ${{ matrix.flags }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-22.04, cxx: g++-11 }
- { os: ubuntu-22.04, cxx: g++-12 }
- { os: ubuntu-22.04, cxx: clang++-13 }
- { os: ubuntu-22.04, cxx: clang++-14 }
- { os: ubuntu-22.04, cxx: clang++-15 }
- { os: ubuntu-24.04, cxx: g++-13 }
- { os: ubuntu-24.04, cxx: g++-14 }
- { os: ubuntu-24.04, cxx: clang++-16 }
- { os: ubuntu-24.04, cxx: clang++-17 }
- { os: ubuntu-24.04, cxx: clang++-18 }
- { os: ubuntu-24.04, cxx: clang++-18, flags: -stdlib=libc++, packages: libc++-18-dev libc++abi-18-dev }
- { os: macos-26, cxx: clang++ }
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install packages
if: matrix.packages
run: sudo apt-get update && sudo apt-get install -y ${{ matrix.packages }}
- name: Build
run: ${{ matrix.cxx }} --version && ${{ matrix.cxx }} -std=c++20 -Wall -Wextra -Werror -pthread ${{ matrix.flags }} -I include tests/build_test.cpp -o build_test
- name: Test
run: ./build_test

windows:
name: ${{ matrix.os }} MSVC
strategy:
fail-fast: false
matrix:
os: [windows-2022, windows-2025]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v7
# Sets up MSVC with vcvars64.bat of the Visual Studio found by vswhere.
- name: Build
shell: cmd
run: |
for /f "usebackq delims=" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do call "%%i\VC\Auxiliary\Build\vcvars64.bat" || exit /b 1
cl /std:c++20 /permissive- /EHsc /W4 /WX /I include tests\build_test.cpp
- name: Test
run: .\build_test.exe
41 changes: 41 additions & 0 deletions lib/trpx2.0/.github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Python

on:
push:
pull_request:

jobs:
# Builds the pyterse extension for each Python version and runs py_tests/pyterse_test.py.
pyterse:
name: ${{ matrix.os }} Python ${{ matrix.python }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: python -m pip install --upgrade pip numpy pybind11
- name: Configure
run: >
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
-DBUILD_TERSECODEC=OFF
-DPython_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"
-Dpybind11_DIR="$(python -m pybind11 --cmakedir)"
- name: Build
run: cmake --build build --config Release
- name: Test
# Multi-config generators (Visual Studio) put the module in a Release subdirectory.
run: |
export PYTHONPATH="$PWD/build/pyterse/Release:$PWD/build/pyterse"
python py_tests/pyterse_test.py -v
5 changes: 5 additions & 0 deletions lib/trpx2.0/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
.vscode/
build/


22 changes: 22 additions & 0 deletions lib/trpx2.0/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.15)
project(pyterse_and_tersecodec LANGUAGES CXX)


option(BUILD_PYTERSE "Build the pyterse Python extension" ON)
option(BUILD_TERSECODEC "Build the HDF5 filter library (tersecodec) plugin" ON)


set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()


if(BUILD_PYTERSE)
add_subdirectory(pyterse)
endif()

if(BUILD_TERSECODEC)
add_subdirectory(tersecodec)
endif()
Loading