I have two hdf files, hdf4 and hdf5. In both cases, I am able to load the files in python using respective libraries (pyhdf and h5py). But inside the files, I can only read the data fields' name, size, and other parameters. The datasets are coming in tuples. I am unable to extract the actual data. Below is the code I am using. I was previously using MATLAB where both worked fine. Any help will be appreciated.
import os
import h5py as hp
import numpy as np
from pyhdf.SD import SD, SDC
path=r'C:\Users\Sky\Desktop'
os.chdir(path)
f1=hp.File('TPR7_uw1_00539.19980101.011127_SAS.hdf')
ds1=f1.keys()
f2=SD('era5_2020_4_17_18.00_23.88_91.24.HDF')
ds2=f2.datasets()
T=ds2["T"] # Temperature
dataset output: