osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to access metadata fields in HDF4 files in Python?


Hi,

I have imported the following libraries to access the data sets from a HDF4 file in Python 2.7

from pyhdf.SD import SD, SDC

hdf = SD(FILE_NAME, SDC.READ)
hdf.datasets()

While I don't have any issues in accessing the contents of the data sets, I am unable to access the metadata.

I have earlier accessed the metadata in MATLAB using the following commands:

metadata = hdfread(infile, '/metadata', 'Fields', 'Lidar_Data_Altitudes', 'FirstRecord',1 ,'NumRecords',1)

alts = metadata{1}

What are the equivalent commands in Python for accessing the metadata fields from a HDF file in Python?

Thanks in advance