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)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay