DEV Community

Cover image for Read Hierarchical Data Format file
masoomjethwa
masoomjethwa

Posted on

Read Hierarchical Data Format file

HDF is a hierarchical data format developed by the National Center for Supercomputing Applications (NCSA)
to support Earth science data from NASA's Earth Observing System (EOS). The specific data structures that contain scientific data are: grid, swath, area average, and range.
Lets know how to open the file and read some important information.

import h5py
fname = r'MOP03J-20100801-L3V5.2.3.he5'
ff = h5py.File(fname, 'r')
Enter fullscreen mode Exit fullscreen mode

Studying the structure of the file by printing what HDF5 groups are present

for key in ff.keys():
    print(key)
Enter fullscreen mode Exit fullscreen mode

Names of the groups in HDF5 file.

Extracting the data

Get the HDF5 group

group = ff[key]
Enter fullscreen mode Exit fullscreen mode

Checkout what keys are inside that group.

for key in group.keys():
    print(key)
Enter fullscreen mode Exit fullscreen mode

Its my first post. Roast me.

Top comments (0)