python读取hdf-eos5数据_python h5py 读取hdf 数据

本文介绍了如何利用Python的h5py库读取HDF5文件。首先,安装了h5py、numpy和pandas等依赖库。接着,通过h5py.File打开HDF5文件,并遍历文件的属性和数据集。对于二维数据集,展示了如何获取列数值并打印。对于一维数据集,也进行了相应的处理。
摘要由CSDN通过智能技术生成

#Env dependent extension packages#pip install h5py -i https://pypi.tuna.tsinghua.edu.cn/simple#pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple#pip install pandus -i https://pypi.tuna.tsinghua.edu.cn/simple

#ruiY

hdfFile= 'Z_SATE_C_BAWX_20201020DF'

importh5py

hdf5File=h5py.File(hdfFile)#print(hdf5File.attrs['ProductID'])#print(hdf5File.attrs.keys())

#FY4 hdf5文件属性数据

for i inrange(len(hdf5File.attrs.keys())):#print(i)

#print(list(hdf5File.attrs.keys())[i])

attrsName =list(hdf5File.attrs.keys())[i]

attrsValue=hdf5File.attrs[attrsName]#print(attrimporttime

time.sleep(3)#FY4 hdf5文件科学数据集数据读取#print(list(hdf5File.keys()))

datasets =list(hdf5File.keys())#print(datasets)

for i inrange(len(datasets)):#print(i)

#hdf5File[]

#print(datasets[i])

dsetsName =datasets[i]#print(dsetsNa

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值