www.cnblogs.com/ruiyqinrui

开源、架构、Linux C/C++/python AI BI 运维开发自动化运维。 春风桃李花 秋雨梧桐叶。“力尽不知热 但惜夏日长”。夏不惜,秋不获。@ruiY--秦瑞

python爬虫,C编程,嵌入式开发.hadoop大数据,桉树,onenebula云计算架构.linux运维及驱动开发.

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
#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))
    

 

 hdfExplorer  hdfviewer

posted on 2020-12-01 15:23  秦瑞It行程实录  阅读(1957)  评论(0编辑  收藏  举报
www.cnblogs.com/ruiyqinrui