The HDF_DFSD_STARTSLICE procedure prepares the system to write a slice of data to a Hierarchical Data Format 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.
fid=HDF_OPEN('test.hdf',/ALL) ; Open an HDF file.
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'
Repeat the process for the second slice:
HDF_DFSD_SETINFO, LABEL='label2', DIMS=[4,5], /DOUBLE
HDF_DFSD_STARTSLICE,'test.hdf'
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_GETINFO, name, DIMS=dims, TYPE=type
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'
SLICE 1 WRITTEN/READ CORRECTLY
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 $
HDF_DFSD_ENDSLICE , HDF_DFSD_GETINFO , HDF_DFSD_GETSLICE , HDF_DFSD_PUTSLICE , HDF_DFSD_SETINFO