How to access metadata fields in HDF4 files in Python?

Madhavan Bomidi blmadhavan at gmail.com
Wed May 22 02:48:43 EDT 2019


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



More information about the Python-list mailing list