如何使用PyNio,Pyhdf或Netcdf4从HDF4文件提取属性?

时间:2019-06-20 20:55:54

标签: python gis netcdf4 pyhdf

我要提取

UpperLeftPointMtrs=(-20015109.354000,1111950.519667)
LowerRightMtrs=(-18903158.834333,0.000000)

来自其StructMetadata.0包含以下信息的HDF4文件的属性(不使用Pyhdf,PyNio或netcdf4进行字符串索引):

INPUT:  print(getattr(file,'StructMetadata.0'))
OUTPUT:

GROUP=SwathStructure
END_GROUP=SwathStructure
GROUP=GridStructure
GROUP=GRID_1
    GridName="MODISRAD"
    XDim=240
    YDim=240
    UpperLeftPointMtrs=(-20015109.354000,1111950.519667)
    LowerRightMtrs=(-18903158.834333,0.000000)
    Projection=GCTP_SNSOID
    ProjParams=(6371007.181000,0,0,0,0,0,0,0,0,0,0,0,0)
    SphereCode=0
    GridOrigin=HDFE_GD_UL
    GROUP=Dimension
        OBJECT=Dimension_1
            DimensionName="Orbit Layers"
            Size=3
        END_OBJECT=Dimension_1
        OBJECT=Dimension_2
            DimensionName="YDim"
            Size=240
        END_OBJECT=Dimension_2
        OBJECT=Dimension_3
            DimensionName="XDim"
            Size=240
        END_OBJECT=Dimension_3
    END_GROUP=Dimension
    GROUP=DataField
        OBJECT=DataField_1
            DataFieldName="PAR"
            DataType=DFNT_FLOAT32
            DimList=("Orbit Layers","YDim","XDim")
        END_OBJECT=DataField_1  . . . . .

如何使用pyhdf,pynio或netcdf4库而不将字符串操作用作索引等?

0 个答案:

没有答案