could not figure out how to read the metadata

2020-05-03 10:14发布

I could not figure out how to read the metadata contained in the following HDF file. I could successfully read the datasets and attributes as follows:

ftp://ladsweb.nascom.nasa.gov/allData/6/MOD07_L2/2014/126/MOD07_L2.A2014126.0640.006.2014126214544.hdf

infile ='MOD07_L2.A2014126.0640.006.2014126214544.hdf'
indata = SD(infile, SDC.READ)
datasets = indata.datasets()
print datasets
reqdata = indata.select('Processing_Flag')
attributes = reqdata.attributes()
print datasets

I hope someone can help me.

标签: pyhdf
1条回答
爱情/是我丢掉的垃圾
2楼-- · 2020-05-03 10:57

You can access the metadata, AKA file attributes, in a similar manner to the way you are accessing the data attributes.

all_metadata = indata.attributes()
print all_metadata
specific_metadata = getattr(indata, 'Pressure_Levels')
print specific_metadata
查看更多
登录 后发表回答