HDF_SD_DIMSET

The HDF_SD_DIMSET function sets the scale and data strings for an SD dimension.

Calling Sequence

HDF_SD_DIMSET, Dim_ID

Arguments

Dim_ID

A dimension ID as returned by HDF_SD _DIMGETID.

Keywords

BW_INCOMP

Set this keyword to write SD dimensions in the "new" (HDF4.1 and later) style. Versions of HDF prior to HDF4.0 beta 2 were inefficient in the use of SD dimensions. HDF now uses a new internal representation of SD dimensions. If the BW_INCOMP keyword is not set, or is explicitly set equal to zero, the current version of HDF writes SD dimensions in both the pre-HDF4.0 format AND the "new" format. This default behavior is called the BW_COMP dimensional compatibility representation.

Setting the BW_INCOMP keyword causes the current dimension to be written in only the "new" (HDF4.1 and later) format. Depending on your HDF file,using this new format can reduce the size of the HDF by up to a factor of 2, but at the expense of incompatibility with pre HDF4.0 beta 2 applications (IDL version 4, for example). The COMPATIBILITY keyword of HDF_SD_DIMGET can be used to check the dimensional compatibility of an HDF dimension.

FORMAT

A string for the dimension format.

LABEL

A string for the dimension label.

NAME

A string for the dimension name.

SCALE

A vector containing the dimension scale values.

UNIT

A string for the dimension unit.

Example

sd_id = HDF_SD_START('myhdf.hdf', /RDWR)
; Initialize the SD interface.

sds_id = HDF_SD_CREATE(sd_id, 'var1', [10,20,0], /LONG)
; Create 3 dimensions.

dim_id=HDF_SD_DIMGETID(sds_id,0) ; Select the first dimension.

HDF_SD_DIMSET, dim_id, NAME='d1', LABEL='l1', $

               FORMAT='f1', UNIT='u1', SCALE=FINDGEN(10)
; Set the data strings and scale for the first dimension.

HDF_SD_ENDACCESS, sds_id;

HDF_SD_END, sd_id ; Close the HDF file to ensure everything is written.

sd_id = HDF_SD_START('myhdf.hdf') ; Reopen the file.

dim_id = HDF_SD_DIMGETID(sds_id,0) ; Select the first dimension.

HDF_SD_DIMGET, dim_id, NAME=d1, LABEL=l1, FORMAT=f1, $

           UNIT=u1, SCALE=sc, COUNT=cnt, NATTR=natt, TYPE=type
; Retrieve the information.

HELP, d1, l1, f1, u1, sc, cnt, natt, type
; Print information about the returned variables.

IDL prints:

D1 STRING = 'd1'

L1 STRING = 'l1'

F1 STRING = 'f1'

U1 STRING = 'u1'

SC FLOAT = Array(10)

CNT LONG = 10

NATT LONG = 3

TYPE STRING = 'FLOAT'

HDF_SD_ENDACCESS,sds_id ; Close the SD interface.

HDF_SD_END, sd_id

See Also

HDF_SD_CREATE , HDF_SD_DIMGET , HDF_SD_DIMGETID , HDF_SD_SELECT