|
Obsolete IDL Features: Obsolete Routines |
|
This routine is obsolete and should not be used in new IDL code.
The HDF_DFSD_STARTSLICE procedure prepares the system to write a slice of data to an HDF file. HDF_DFSD_SETINFO must be called before HDF_DFSD_STARTSLICE to set the dimensions and attributes of the slice.
This procedure must be called before calling HDF_DFSD_PUTSLICE, and must be terminated with a call to HDF_DFSD_ENDSLICE.
HDF_DFSD_STARTSLICE, Filename
A scalar string containing the name of the file to be written.
; Open an HDF file:
fid=HDF_OPEN('test.hdf',/ALL)
; Create two datasets:
slicedata1=FINDGEN(5,10,15)
slicedata2=DINDGEN(4,5)
; Use HDF_DFSD_SETINFO to set the dimensions, then add
; the first slice:
HDF_DFSD_SETINFO,LABEL='label1', DIMS=[5,10,15], /FLOAT
HDF_DFSD_STARTSLICE,'test.hdf'
HDF_DFSD_PUTSLICE, slicedata1
HDF_DFSD_ENDSLICE
; Repeat the process for the second slice:
HDF_DFSD_SETINFO, LABEL='label2', DIMS=[4,5], /DOUBLE
HDF_DFSD_STARTSLICE,'test.hdf'
HDF_DFSD_PUTSLICE, slicedata2
HDF_DFSD_ENDSLICE
HDF_DFSD_SETINFO, /RESTART
; Use HDF_DFSD_GETINFO to advance slices and set slice
; attributes, then get the slices:
HDF_DFSD_GETINFO, name, DIMS=dims, TYPE=type
HDF_DFSD_GETSLICE, out1
HDF_DFSD_GETINFO, name, DIMS=dims, TYPE=type
HDF_DFSD_GETSLICE, out2
; Close the HDF file:
HDF_CLOSE('test.hdf')
;Check the first slice to see if everything worked:
IF TOTAL(out1 EQ slicedata1) EQ N_ELEMENTS(out1) THEN $
PRINT, 'SLICE 1 WRITTEN/READ CORRECTLY' ELSE $
PRINT, 'SLICE 1 WRITTEN/READ INCORRECTLY'
; Check the second slice to see if everything worked:
IF TOTAL(out2 EQ slicedata2) EQ N_ELEMENTS(out2) THEN $
PRINT, 'SLICE 2 WRITTEN/READ CORRECTLY' ELSE $
PRINT, 'SLICE 2 WRITTEN/READ INCORRECTLY'
SLICE 1 WRITTEN/READ CORRECTLY SLICE 2 WRITTEN/READ CORRECTLY
IDL Online Help (March 06, 2007)