The HDF_SD_SETEXTFILE procedure moves data values from a dataset into an external file. Only the data is moved—all other information remains in the original file. This routine can only be used with HDF version 3.3 (and later) files, not on older HDF files or NetCDF files. Data can only be moved once, and the user must keep track of the external file(s). The OFFSET keyword allows writing to an arbitrary location in the external file.
As shown in the example, when adding data to an external file SD, you must first use HDF_SD_ENDACCESS to sync the file, then reacquire the SDS ID with HDF_SD_SELECT before using HDF_SD_SETEXTFILE.
Examples
SDinterface_id = HDF_SD_START('ext_main.hdf', /CREATE)
SDdataset_id = HDF_SD_CREATE(SDinterface_id, 'float_findgen', [3,5], /FLOAT)
HDF_SD_ADDDATA, SDdataset_id, FINDGEN(3,5)
HDF_SD_ENDACCESS,SDdataset_id
SDdataset_id = HDF_SD_SELECT(SDinterface_id, 0)
HDF_SD_SETEXTFILE, SDdataset_id, 'findgen.hdf'
HDF_SD_GETDATA, SDdataset_id, fout
PRINT, fout
HDF_SD_ENDACCESS, SDdataset_id
HDF_SD_END, SDinterface_id
IDL Output
0.00000 1.00000 2.00000
3.00000 4.00000 5.00000
6.00000 7.00000 8.00000
9.00000 10.0000 11.0000
12.0000 13.0000 14.0000
Syntax
HDF_SD_SETEXTFILE, SDdataset_id, Filename [, OFFSET=bytes]
Arguments
SDdataset_id
An SD dataset ID as returned by HDF_SD_SELECT.
Filename
The name of the external file to be written.
Keywords
OFFSET
Set this keyword to a number of bytes from the beginning of the external file at which data writing should begin. Exercise extreme caution when using this keyword with existing files.
Version History
See Also
HDF_SD_END, HDF_SD_ENDACCESS, HDF_SD_SELECT, HDF_SD_START