python - 如何处理无法打开的 HDF5 文件
问题描述
我正在使用 Python h5py 库,我不是 C/C++ 程序员。
我有一个文件无法读取,因为创建数据集的长写入操作被中断。
如果可能的话,我希望能够打开文件并删除损坏的数据集,以便我可以重新加载它而不会丢失所有其他数据。
我尝试使用给定的错误消息在以下 HDF5 实用程序中打开该文件。
h5转储:
h5dump error: unable to open file "test.h5"
高清视图:
Error opening file test.h5
HDF罗盘:
INFO pydap.request:39 > Opening file:///C:\Users\HIAPRC\Documents\CH149\One_off_code\hdf5_check\test.h5.dds
DEBUG hdf_compass.opendap_model.model.can_handle:61 > able to handle file:///C:\Users\HIAPRC\Documents\CH149\One_off_code\hdf5_check\test.h5? no
DEBUG hdf_compass.asc_model.model.can_handle:74 > able to handle file:///C:\Users\HIAPRC\Documents\CH149\One_off_code\hdf5_check\test.h5? no, missing .asc extension
Traceback (most recent call last):
File "c:\users\john\hdf-compass\hdf_compass\compass_viewer\frame.py", line 199, in on_file_open
File "c:\users\john\hdf-compass\hdf_compass\compass_viewer\frame.py", line 223, in open_url
File "c:\users\john\hdf-compass\hdf_compass\compass_viewer\viewer.py", line 175, in can_open_store
File "c:\users\john\hdf-compass\hdf_compass\bag_model\model.py", line 88, in can_handle
File "site-packages\hydroffice\bag\base.py", line 31, in is_bag
File "site-packages\h5py\_hl\files.py", line 272, in __init__
File "site-packages\h5py\_hl\files.py", line 92, in make_fid
File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (C:\aroot\work\h5py\_objects.c:2587)
File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (C:\aroot\work\h5py\_objects.c:2546)
File "h5py\h5f.pyx", line 76, in h5py.h5f.open (C:\aroot\work\h5py\h5f.c:1821)
IOError: Unable to open file (Bad object header version number)
任何有关如何进行的线索将不胜感激。提前致谢。
解决方案
推荐阅读
- javascript - 如何将一串带有逗号的数字转换为整数并将它们相加?
- date - boto 3 - 丢失日期格式
- laravel - laravel 组合两个 csv 而不覆盖每个中的相似数据
- r - How to knitr beamer slides using Frankfurt theme without loosing navigation circles
- amazon-web-services - AWS Cloudwatch 将日志记录到 Azure Log Analytics
- google-sheets - 广泛特定单元格的总和
- c - 使用 (char **) 与 (const * char *) 与 (const char **)
- java - 如何在 Windows 上设置 JUNIT 以使用 Sublime 和命令行?
- reactjs - Reactjs:使用类与功能组件的最佳实践是什么?
- node.js - 在 puppeteer 中使用 browser.close() 与简单地终止整个程序有何不同?