C: status = DFPaddpal(filename, palette);
FORTRAN: status = dpapal(filename, palette)
OR
C: status = DFPputpal(filename, palette, overwrite, filemode);
FORTRAN: status = dpppal(filename, palette, overwrite, filemode)DFPaddpal and DFPputpal will write a palette to an HDF file named by
filename
. When given a new filename, DFPputpal and DFPaddpal creates a new file and writes the palette as the first object in the file. When given an existing filename, DFPaddpal appends the palette to the end of the file. DFPputpal provides this functionality as well with additional options for how the data is handled, providing more control over how a palette is written to file than DFPaddpal. Specifically, the
overwrite
parameter determines whether or not to overwrite the last palette written to a file or to append a new palette onto the file. The filemode
parameter determines whether to create a new file or to append the data to the previous file. Note the combination to overwrite a palette in a newly created file is invalid and will generate an error. To overwrite a palette, filename
must be the same filename as the last file accessed through the DFP interface. The parameters for DFPaddpal and DFPputpal are more explicitly defined in the following table.
EXAMPLE 1. Writing a Palette
In the following code examples, DFPaddpal is used to write a palette to an HDF file named "Example1.hdf".
9.4.2 Specifying the Reference Number of a Palette: DFPwriteref
DFPwriteref specifies the reference number of the palette to be written on the next call to DFPaddpal or DFPputpal:C: status = DFPwriteref(filename, ref);
status = DFPaddpal(filename, palette);
FORTRAN: status = dpwref(filename, ref)
status = dpapal(filename, palette)
DFPwriteref assigns the specified reference number to the next palette written to the file filename
. If the value of ref
is the same as the reference number of an existing palette, the existing palette will be overwritten. TABLE 9C - DFPwriteref Parameter List