could not figure out how to read the metadata

独自空忆成欢 提交于 2019-12-31 05:25:06

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/26559319/could-not-figure-out-how-to-read-the-metadata

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!