HDF_SD_IDTOREF

The HDF_SD_IDTOREF function converts a SD data set ID into a SD data set reference number. The reference number can be used to add the SD data set to a Vgroup through the HDF_VG interface. The tag number for an SD is 720.

Calling Sequence

Result = HDF_SD_IDTOREF( SDS_ID )

Arguments

SDS_ID

A SDS_ID as returned from HDF_SD_CREATE or HDF_SD_SELECT .

Example

Create an SD data set and get the Reference number.

file_id = HDF_OPEN('demo.hdf', /RDWR)

sd_id = HDF_SD_START('demo.hdf', /RDWR)

dim=[100]

sds_id = HDF_SD_CREATE(sd_id, 'demo_data', dim, /FLOAT)

ref = HDF_SD_IDTOREF(sds_id)

HDF_SD_ADDDATA, sds_id, FINDGEN(100)/10.45 + 2.98

HDF_SD_ENDACCESS, sds_id

HDF_SD_END, sd_id

Use the Reference number to add the SD to a Vgroup ;

SD_TAG = 720

vgID = HDF_VG_GETID(file_id,-1)

vg_handle = HDF_VG_ATTACH(file_id, vgID, /WRITE)

HDF_VG_SETINFO, vg_handle, name='data1', class='demo'

HDF_VG_ADDTR, vg_handle, SD_TAG, ref

Use HDF_VG_INQTR to verify the SD was added correctly :

IF HDF_VG_INQTR(vg_handle, SD_TAG, ref) then $

    PRINT, 'SUCCESS' ELSE PRINT, 'Failure'

IDL prints:

SUCCESS

HDF_VG_DETACH, vg_handle

HDF_CLOSE, file_id

See Also

HDF_SD_CREATE , HDF_SD_NAMETOINDEX , HDF_SD_REFTOINDEX , HDF_SD_SELECT , HDF_VG_ADDTR , HDF_VG_ATTACH , HDF_VG_DETACH , HDF_VG_GETID , HDF_VG_INQTR