The HDF_DFP_PUTPAL procedure appends a palette to a Hierarchical Data Format file.
id = HDF_OPEN('test.hdf', /CREATE, /RDWR)
;
Create an HDF file.
HDF_DFP_PUTPAL,'test.hdf'', FINDGEN(3,256)
;
Add a palette.
PRINT, HDF_DFP_NPALS('test.hdf') ; Print the number of palettes.
HDF_DFP_PUTPAL,'test.hdf',findgen(3,256)
;
Append a palette.
PRINT, HDF_DFP_NPALS('test.hdf') ; Print the number of palettes.
HDF_DFP_PUTPAL, 'test.hdf', FINDGEN(3,256), /OVERWRITE
;
Overwrite the last palette.
PRINT, HDF_DFP_NPALS('test.hdf') ; Print the number of palettes.
An attempt to delete a file and add a new palette without first closing the HDF file fails:
HDF_DFP_PUTPAL, 'test.hdf', FINDGEN(3,256), /DELETE
% HDF_DFP_PUTPAL: Could not write palette
HDF_CLOSE, id ; Close the HDF file.
HDF_DFP_PUTPAL, 'test.hdf', FINDGEN(3,256), /DELETE
;
Delete file and add a new palette.
PRINT, HDF_DFP_NPALS('test.hdf') ; Print the number of palettes.