Hi Landon,

What you encountered is the result of a deficiency in HDF4 and there is no way 
for your function to return the correct data set without having more 
information.  You can see more information about this problem in the Know 
Problem section of the release notes, at:


https://support.hdfgroup.org/ftp/HDF/releases/HDF4.2.12/src/hdf-4.2.12-RELEASE.txt


So, adding more argument to your function is unavoidable, I'm afraid.


In HDF5, datasets can be specified with absolute paths, so you won't have this 
problem.  Perhaps, converting the h4 files to h5 using the h4toh5 tool is an 
option.  Unfortunately, you'll still need to rewrite your program.


Thank you,

Binh-Minh


________________________________
From: Hdf-forum <[email protected]> on behalf of Landon 
Clipp <[email protected]>
Sent: Tuesday, November 22, 2016 3:59 PM
To: HDF Users Discussion List
Subject: [Hdf-forum] HDF4 Multiple datasets with same name

Hello everyone,

I am writing a program in HDF4. In one of my files, I have a few datasets that 
have the same name, although in different groups. Currently, I have some highly 
abstracted functions I have written that ultimately call the HDF4 function 
SDnametoindex(). An SD name is passed into my function which is passed to 
SDnametoindex which will select the appropriate dataset. The problem I have now 
is that there are now multiple datasets with the same name, and SDnametoindex 
will only select the first one. I need the ability to specify exactly which 
dataset I want. I was wondering if there was a way to give an absolute path to 
the dataset which would then give me the appropriate index. As I understand it, 
SDnametoindex does not allow for absolute paths.

I could use SDnametoindicies() to keep track of which of the same-name datasets 
I've already visited, but changing much of my function would require rewriting 
large portions of my entire program and I want to avoid that if there is a 
simpler solution. My function is easy to use in that all the caller needs to 
provide is the name of the dataset, not any dataset or group identifiers. I 
would like to keep such ease of use if possible. Thanks.

Regards,
Landon Clipp
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Reply via email to