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.
Examples
SDinterface_id = HDF_SD_START('compress.hdf', /CREATE)
SDdataset_id = HDF_SD_CREATE(SDinterface_id, 'dataset1', [9,40], /LONG)
HDF_SD_SETCOMPRESS,SDdataset_id,4,EFFORT=9
HDF_SD_ADDDATA,SDdataset_id,fix(dist(9,40))
HDF_SD_ENDACCESS, SDdataset_id
HDF_SD_END, SDinterface_id
Note: 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.
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:
- 0 = NONE (no compression)
- 1 = RLE (run-length encoding)
- 3 = SKIPPING HUFFMAN
- 4 = GZIP
Note: All compression types are lossless.
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.
Version History