The HDF_SD_DIMSET function sets the scale and data strings for an SD dimension.
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.
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_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.
HDF_SD_CREATE , HDF_SD_DIMGET , HDF_SD_DIMGETID , HDF_SD_SELECT