The HDF_SD_NAMETOINDEX function returns an SD dataset index given its name and SD interface ID. An error message is printed if the dataset cannot be located. The returned index can be used by HDF_SD_SELECT to access an SD dataset.
sd_id = HDF_SD_START('demo.hdf') ; Start the SD interface.
index = HDF_SD_NAMETOINDEX(sd_id, 'variable_2')
;
Return the index of the `variable_2' dataset.
sds_id=HDF_SD_SELECT(sd_id,index) ; Access the dataset.