Skip to content

Commit c61e7f0

Browse files
committed
add from_filter_options to documentation
1 parent df061ed commit c61e7f0

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

doc/usage.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,34 @@ Zstd
130130
:members:
131131
:undoc-members:
132132

133+
134+
Get dataset compression
135+
+++++++++++++++++++++++
136+
137+
For compression filters provided by HDF5 and `h5py`_ (i.e., GZIP, LZF, SZIP),
138+
dataset compression configuration can be retrieved with `h5py.Dataset`_'s
139+
`compression <https://docs.h5py.org/en/stable/high/dataset.html#h5py.Dataset.compression>`_ and
140+
`compression_opts <https://docs.h5py.org/en/stable/high/dataset.html#h5py.Dataset.compression_opts>`_ properties.
141+
142+
For third-party compression filters such as the one supported by `hdf5plugin`,
143+
the dataset compression configuration is stored in HDF5
144+
`filter pipeline <https://docs.h5py.org/en/stable/high/dataset.html#filter-pipeline>`_.
145+
This filter pipeline configuration can be retrieved with `h5py.Dataset`_ "low level" API.
146+
For a given `h5py.Dataset`_, ``dataset``:
147+
148+
.. code-block:: python
149+
150+
create_plist = dataset.id.get_create_plist()
151+
152+
for index in range(create_plist.get_nfilters()):
153+
filter_id, _, filter_options, _ = create_plist.get_filter(index)
154+
print(filter_id, filter_options)
155+
156+
For compression filters supported by `hdf5plugin`,
157+
:func:`hdf5plugin.from_filter_options` instantiates the filter configuration from the filter id and options.
158+
159+
.. autofunction:: from_filter_options
160+
133161
Get information about hdf5plugin
134162
++++++++++++++++++++++++++++++++
135163

@@ -176,3 +204,4 @@ Setting the ``HDF5_PLUGIN_PATH`` environment variable allows already existing pr
176204
.. _h5py: https://www.h5py.org
177205
.. _h5py.h5z: https://github.com/h5py/h5py/blob/master/h5py/h5z.pyx
178206
.. _h5py.Group.create_dataset: https://docs.h5py.org/en/stable/high/group.html#h5py.Group.create_dataset
207+
.. _h5py.Dataset: https://docs.h5py.org/en/stable/high/dataset.html

0 commit comments

Comments
 (0)