HDF_SD_SETCOMPRESS
Syntax | Arguments | Keywords | Examples | Version History
The HDF_SD_SETCOMPRESS procedure compresses an existing HDF SD dataset or sets the compression method of a newly created HDF SD dataset. Available compression methods are No Compression, run-length encoding (RLE), adaptive (skipping) huffman, and GZIP compression. All of these compression methods are lossless. When using skipping huffman compression, IDL automatically determines the correct skipping size. The EFFORT keyword determines the effort applied when using GZIP compression (i.e., when comptype is 4). In general, the default GZIP compression method is the best combination of speed and file size reduction.
Syntax
HDF_SD_SETCOMPRESS, SDdataset_id, comptype [, EFFORT=integer{1 to 9}]
Arguments
SDdataset_id
The HDF SD dataset id as returned by HDF_SD_CREATE or HDF_SD_SELECT.
Comptype
The compression type to be applied to the HDF SD dataset. Allowable values are:
Keywords
EFFORT
If the comptype is set to 4 (GZIP), then this keyword specifies the effort that GZIP expends in compressing the dataset. The EFFORT keyword is restricted to the range 1 (minimal compression, fastest) to 9 (most compressed, slowest). The default is EFFORT=5.
Examples
; Create an HDF SD file: SDinterface_id = HDF_SD_START('compress.hdf', /CREATE) ; Create an SDS dataset: SDdataset_id = HDF_SD_CREATE(SDinterface_id, 'dataset1', [9,40], /LONG) ; Maximal GZIP compression: HDF_SD_SETCOMPRESS,SDdataset_id,4,EFFORT=9 ; Write the data to be compressed: HDF_SD_ADDDATA,SDdataset_id,fix(dist(9,40)) ; End access to the SDS: HDF_SD_ENDACCESS, SDdataset_id ; End access to the SD interface: HDF_SD_END, SDinterface_idNote
Compression of HDF SD datasets is a new feature as of HDF 4.1r2 / IDL 5.2.1. Attempts to read HDF SD datasets not created with HDF 4.1r2 (IDL 5.1) or greater will give unpredictable results. Attempts to read HDF compressed SD datasets with IDL versions prior to IDL 5.1, or other HDF readers that use an HDF version prior to HDF 4.1r2, will fail.
Version History