Routines (alphabetical) > Routines: H > HDF Routines > HDF_SD_IDTOREF

# 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.

## Examples

; Create an SD data set and get the Reference number:

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

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

dim=[100]

SDdataset_id = HDF_SD_CREATE(SDinterface_id, 'demo_data', dim, /FLOAT)

ref = HDF_SD_IDTOREF(SDdataset_id)

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

HDF_SD_ENDACCESS, SDdataset_id

HDF_SD_END, SDinterface_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'

HDF_VG_DETACH, vg_handle

HDF_CLOSE, file_id

#### IDL Output

SUCCESS

## Syntax

Result = HDF_SD_IDTOREF(SDdataset_id)

## Return Value

Returns the SD data set reference number.

## Arguments

### SDdataset_id

A SDdataset_id as returned from HDF_SD_CREATE or HDF_SD_SELECT.

## Keywords

None

## Version History

4.0 | Introduced

## 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