1

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.

Roman
  • 3,007
  • 8
  • 26
  • 54

1 Answers1

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
Heather QC
  • 680
  • 8
  • 11