python h5py 读取hdf 数据

摘要:
#环境相关扩展包#pipinstallh5py-ihttps://pypi.tuna.tsinghua.edu.cn/simple#pipinstallnumpy - ihttps://pypi.tuna.tsinghua.edu.cn/simple#pipinstallpandus - ihttps://pypi.tuna.tsinghua.edu.cn/si
#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'


import h5py

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

#FY4 hdf5文件属性数据
for i in range(len(hdf5File.attrs.keys())):
    #print(i)
    #print(list(hdf5File.attrs.keys())[i])
    attrsName = list(hdf5File.attrs.keys())[i]
    attrsValue = hdf5File.attrs[attrsName]
    #print(attrimport time
time.sleep(3)
  
#FY4 hdf5文件科学数据集数据读取
#print(list(hdf5File.keys()))
datasets = list(hdf5File.keys())
#print(datasets)
for i in range(len(datasets)):
    #print(i)
    #hdf5File[]
    #print(datasets[i])
    dsetsName = datasets[i]
    #print(dsetsName)
    #time.sleep(2)
    #dsetsDtype = dsetsName.dtype
    #dsetsShape = dsetsName.shape
    #print(dsetsName)
    #print(dsetsName.dtype)
    #print('{}:{}:{}'.format(dsetsName,dsetsDtype,dsetsShape))
    #print(dsetsName.shape)
    #print('{}:{}:{}'.format(dsetsName,dsetsDtype,dsetsShape))
    #print('{}:{}'.format(dsetsName,dsetsShape))
    #print(type(dsetsShape)) #数据集类型
    #print(len(dsetsShape))  #数据集纬度
    
    #print(dsetsDimsX)
    #print(dsetsShape[0])
    dsetsDimsX = dsetsShape[0]
    #dsetsDims = len(dsetsShape)#判读纬度,一维数组就不用获取Yi列值
    #print('{},{},{}'.format(dsetsName,dsetsDimsX,dsetsDimsY))
    '''
    for Xi in range(dsetsDimsX):
        #print(Xi)
        #for Yi in range(dsetsDimsY):
            #print('{},{}'.format(Xi,Yi))
        #   pass
        if len(dsetsShape) == 2:
            #dsetsDimsXY = dsetsShape[1]
            #print(dsetsDimsXY)
            #///////print('{},{}'.format('二维',dsetsName))
            dsetsDimsY = dsetsShape[1]  #获取二维列数值
            #print(dsetsDimsY)
            for Yi in range(dsetsDimsY):
                #print('{}:{},{}'.format(dsetsName,Xi,Yi))  #输出二维数据集对应的数据集名称及二维排列
                #print()
                pass
                #//////二维列值
        else:
            #print('{},{}'.format('一维',dsetsName))
            #DimOneSetValues = list(dsetsName[Xi - 1])
            #print(DimOneSetValues)
            DimOneSetValues = list(dsetsName)
            print(DimOneSetValues)
    '''
    if len(dsetsShape) == 2:
        print('{},{}'.format('二维数集',dsetsName))
        dsetsDimsY = e,Xi,Yi,dimTwosSetValues))
    else:
        print('{},{}'.format('一维数集',dsetsName))
        
        for Xi in range(dsetsDimsX):
            dimOneSetValues = ''
            #DimOneSetValues = dsetsName[Xi - 1]
            #print(DimOneSetValues)
            #print(Xi)
            #print(typat(dsetsName,Xi,dimOneSetValues))
    

python h5py 读取hdf 数据第1张

 hdfExplorer  hdfviewer

免责声明:文章转载自《python h5py 读取hdf 数据》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇ORA-02095: specified initialization parameter cannot be modified常用颜色表下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

python多进程那点事儿【multiprocessing库】

      前言:项目中有个需求需要对产品的日志处理,按照产品中日志的某些字段,对日志进行再次划分。比如产品的日志中含有字段id,tag=1,现在需要把tag是基数的放到一个文件中,tag是偶数的放入一个文件中。这就涉及到多个文件的读写操作,一个文件一个文件读取写入那时间太久了,公司配备的单机,跑了半个多小时,光标还是一直在闪闪闪【你懂得】。没办法了,还是...

python程序打包成.exe----pyinstaller工具

1. 环境 windows 2. 安装 准备文件:PyWin32 or pypiwin32  运行如下安装命令:  pip install pyinstaller==3.0 不要使用3.2版本,编译完成后会报Runtime Error, R6034错误. 3.0版本无此问题。 3. 打包 把.py或.pyw文件拷贝到pyinstaller所在目录 执行命令...

修改python的pip镜像源

1、如果只是暂时使用的话 pip install [模块] -i https://pypi.douban.com/simple 2、Mac永久修改镜像地址: 需要修改 ~/.pip/pip.conf 的内容操作 进入根目录:cd ~/ 进入.pip目录 cd .pip如果不存在文件夹就新建mkdir .pip 进入 cd .pip创建pip.conf文...

【大数据课堂0003】【import】__file__ 作用以及模块导入方法

【原理】import 导入模块,就是能够根据sys.path环境变量的值,找到具体模块的路径。 import上一级目录的模块===> sys.path.insert(0,'../') #最简洁做法 python 执行py 文件的时候,默认就会把当前目录增加到sys.path中。sys.path[0]。 – src   |– mod1.py   |...

用python的curl和lxml来抓取和分析网页内容

Curl是一个强大的URL语法的客户端,支持DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS等多种协议。 Lxml是python一个非常好用的xml模块,同时支持html的...

Python编程软件的安装与使用——Windows、Linux和Mac

Python版本:3.6.2  操作系统:Windows  作者:SmallWZQ        最近,有读者透露:Python软件如何安装?为什么自己安装的软件会有各种“奇怪”的问题?据此,本篇随笔将具体讲述如何安装Python 3.x版本的软件。特别地,篇中所述的不是安装文本编辑器(比如Notepad++,Sublimetext,PyCharm.......