I have a HDF4 file I need to read with python. For this I use pyhdf
. In most cases I am quite happy to use SD
class to open the file:
import pyhdf.SD as SD
hdf = SD.SD(hdfFile)
and then continue with
v1 = hdf.select('Data set 1')
v2 = hdf.select('Data set 2')
However I have several groups in the HDF file and some variables appear in more than one group having the same name:
In Group 1
I have Data set 3
and in Group 2
I have Data set 3
so my select
command will only select one of then I guess (without me knowing which one?).
Is there a simple way of selecting (reading) Data set 3
from Group 1
and then from Group 2
?
I have looked at the V
and VS
modules. I found an example script that will loop through all groups and subgroups etc. and find all variables (data sets). But I have now Idea of how to connect those variables to the parent, as for me to know into which group they belong.