Hdf5
跳到导航
跳到搜索
The Hierarchical Data Format (HDF) version 5 file format was designed for scientific data consisting of a hierarchy of datasets and attributes (or metadata). HDF is a product of the National Center for Supercomputing Applications (NCSA), which supplies the underlying C-language library;
IDL
- IDL provides access to this library via a set of procedures and functions contained in a dynamically loadable module (DLM).
IDL>HELP, 'hdf5', /DLM
- 查看Hdf5的文件结构,并直接读取
IDL>file=h5_parse(filename,/read_data) ;IDL 7.1 IDL>file=h5_browser(filename) ;可视化界面
- pro: H5F_open,H5D_open,H5D_read,H5D_CLOSE
python
h5py
import h5py
#打开HDF5文件:
file = h5py.File('example.h5', 'r')
#查看文件中的组和数据集:
groups = list(file. Keys())
datasets = [name for name in file if isinstance(file[name], h5py.Dataset)]
print('Groups:', groups)
print('Datasets:', datasets)
#读取数据集:
dataset = file['data']
data = dataset[:]
print('Data shape:', data. Shape)
print('Data:', data)
#关闭文件:
file. Close()
pandas
import pandas as pd
data = pd.read_hdf('example.h5', key='data')
print(data)