HDF_DFP_PUTPAL

The HDF_DFP_PUTPAL procedure appends a palette to a Hierarchical Data Format file.

Calling Sequence

HDF_DFP_PUTPAL, Filename, Palette

Arguments

Filename

A scalar string containing the name of the file to be written.

Palette

A vector or array containing palette data. Palettes must be either [3, 256] arrays or 786-element vectors.

Keywords

DELETE

Set this keyword to delete the HDF file (if it exists) and create a new HDF file with the specified palette as its first object.

OVERWRITE

Set this keyword to overwrite the previous palette with the one specified by Palette .

Example

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.

IDL prints:

1

HDF_DFP_PUTPAL,'test.hdf',findgen(3,256)
; Append a palette.

PRINT, HDF_DFP_NPALS('test.hdf') ; Print the number of palettes.

IDL prints:

2

HDF_DFP_PUTPAL, 'test.hdf', FINDGEN(3,256), /OVERWRITE
; Overwrite the last palette.

PRINT, HDF_DFP_NPALS('test.hdf') ; Print the number of palettes.

IDL prints:

2

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

IDL prints:

% HDF_DFP_PUTPAL: Could not write palette

% Execution halted at: $MAIN$

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.

IDL prints:

1