如何在h5py中指定自定义压缩过滤器 [英] how to specify a custom compression filter in h5py

查看:82
本文介绍了如何在h5py中指定自定义压缩过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据他们的h5py文档,压缩过滤器可以由基础HDF5库动态加载.这是通过将过滤器编号作为参数作为参数传递给Group.create_dataset()来完成的."我有以下代码(工作正常):

According to they h5py documentation, "compression filters can be dynamically loaded by the underlying HDF5 library. This is done by passing a filter number to Group.create_dataset() as the compression parameter." I have the following code (which works fine):

import numpy as np
a = np.random.random(1e5)
with h5py.File(args.baseName + '/allubf.h5', libver='latest') as f:
    dset = f.create_dataset('myData', (1000,), dtype=np.dtype(float), chunks=(1000,), compression='lzf', shuffle=True)

我在此处中查找了压缩过滤器ID,并尝试将"lzf"替换为32000 ,根据上面的链接,它应该是lzf的ID.这样做时,出现错误ValueError:压缩过滤器"32000"不可用.我找不到更多的文档或示例.我是否需要以某种方式预加载过滤器以使其可用?

I looked up compression filter IDs here and tried to replace 'lzf' with 32000, which should be the ID for lzf according to the above link. When I do that, I get the error ValueError: Compression filter "32000" is unavailable. I can't find any more documentation or examples for this. Do I need to somehow pre-load the filter in order to make it available?

推荐答案

似乎文档在发布的库之前. 该功能在 GitHub存储库上可用,但在pypi版本中尚不可用(这是您拥有的一个功能)如果您使用easy_install或pip安装h5py).如果要使用自定义压缩过滤器,则必须使用GitHub中的版本,等待pypi版本更新,或应用

It appears the documentation is ahead of the released library. This feature is available on the GitHub repository but is not yet available in the pypi version (this is one you have if you used easy_install or pip to install h5py). If you want to use custom compression filters you will either have to use the version from GitHub, wait for the pypi version to be updated, or apply this set of changes.

这篇关于如何在h5py中指定自定义压缩过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆