HDF4 File loader: read sds attribute ?

Hi

I need to read hdf4 files having an unknown number of sds and extract the data and attributes of the SDS which contains a given keyphrase in the attributes: see screenshot from hdfviewer: I want to read the data from summary_Data_time and Summary_Data_UV as well as the list of Beam numbers in the attributes of Data_Summary_UV.


I am really confused with the hdfinfo and hdfreadsds...

Using a matlab script with i being an integer for the refnumber i do
info.SDS(i).Name to access to the SDS name and scan over the various ref numbers to find the one for which the name matches 'SUMMARY_DATA_UV'

then to get the list of beams I do

info.SDS(ii).Attributes(1).Value

I see how to use hdfinfo sdsinfo to get the number of SDSs but then I don't see how to perform such a query with hdfreadsds
It looks to me like the tag for "Scientific Data" is 702. So this command:
HDFInfo/P=<your symbolic path name> mode=5, tag=702, "<your file name>"

will create a wave named HDF_List that contains the reference number for each SDS in the file. So numpnts(HDF_List) is the total number of SDS's in the file and HDF_List[i] is the reference number for the ith SDS.

Once you have the reference number you can use:
HDFInfo/P=<your symbolic path name> ref=<your ref number>, SDSInfo, "<your file name>"

to get more information and then HDFReadSDS to load the data.

The list of HDF tag numbers is at http://www.hdfgroup.org/training/HDFtraining/UsersGuide/Appndx1.html#24…
Great, Thank you very much for this.

Note that it seems you are using mode=5 but in the help file , it is not described
hrodstein wrote:
It looks to me like the tag for "Scientific Data" is 702. So this command:
HDFInfo/P=<your symbolic path name> mode=5, tag=702, "<your file name>"


Here is a snapshot of the HDF4loader help that I have:

Mode=m The following 9 modes can be specified using the corresponding keywords. All combination of modes can also be achieved using the key word Mode set equal to the sum of the required modes.
0: Default. Lists information on all elements in the file.
1: Lists the reference number of all elements whose tag is specified by the Tag keyword.
2: Lists the tags for all elements whose reference number is specified by the Ref keyword.
4: Lists output in a numeric wave named HDF_List instead of in the history. Use this in conjunction with mode=1 or mode=2.
16: Includes a description of the tag when listing. Use in conjunction with mode=1 or mode=2.
32: Lists 8 and 24 bit images only.
64: Lists SDS elements only.
128: Lists Vset elements only.
256: Set variable HDF_Flag to 1 if an element (specified by Ref and Tag keywords) exists in the file or to 0 if it does not exist.



Quote:
Note that it seems you are using mode=5 but in the help file , it is not described


The help says you can use "all combinations of modes". This means you can add 1 and 4 to get both.
OK, that was probably the most critical piece of info that I did not get ;-)

Thanks a lot for the tips !