HDF_SD_SETINFO

The HDF_SD_SETINFO procedure sets information about an SD dataset.

Calling Sequence

HDF_SD_SETINFO, SDS_ID

Arguments

SDS_ID

An SD dataset ID as returned by HDF_SD _SELECT or HDF_SD_CREATE.

Keywords

FILL

Set this keyword to the fill value of the SD dataset.

FORMAT

Set this keyword to a string to be used as the SD dataset format.

LABEL

Set this keyword to a string to be used as the SD dataset label.

RANGE

Set this keyword to a two dimensional array that contains the minimum and maximum values of the SD dataset.

UNIT

Set this keyword to a string to be used as the SD dataset units.

COORDSYS

Set this keyword to a string to be used as the SD dataset coordinate system.

CALDATA

Set this keyword to a structure that contains the calibration data. This structure must contain five tags as shown below. The first four tags are of double-precision floating-point type. The fifth tag should be a long integer that specifies the HDF number type. The structure should have the following form:

CALDATA={ Cal: 0.0D $ ; Calibration Factor

      Cal_Err: 0.0D $ ; Calibration Error

       Offset: 0.0D $ ; Uncalibrated Offset

       Offset_Err: 0.0D $ ; Uncalibrated Offset Error

       Num_Type: 0L } ; Number Type of Uncalibrated Data

The relationship between HDF and IDL number types is illustrated by the following table:

HDF Number Type

IDL Data Type

0L

UNDEFINED

3L

STRING

21L

BYTE

22L

INTEGER

24L

LONG INTEGER

5L

FLOATING-POINT

6L

DOUBLE-PRECISION

The relationship between the calibrated data (CD) and the uncalibrated data (UD) is given by the equation:

CD = Cal * (UD - Offset) ; Cal and Offset are the values of the Cal; and Offset; structure fields described above.

Example

sd_id = HDF_SD_START('demo.hdf', /RDWR)
; Open an HDF file.

sds_id = HDF_SD_CREATE(sd_id, 'variable1', [10, 20], /DOUBLE)
; Define a new dataset for the file.

CAL={Cal:1.0D, Cal_Err:0.1D, Offset:2.5D, Offset_Err:0.1D, $

     Num_Type:6L} ; Create a calibration data structure.

HDF_SD_SETINFO, sds_id, LABEL='label1', unit='unit1', $

                format='format1', coordsys='coord1', $

                FILL=999.991, RANGE=[99.99,-78], caldata=CAL
; Set information about the dataset.

HDF_SD_GETINFO, sds_id, LABEL=l, UNIT=u, FORMAT=f, $

                COORDSYS=c, FILL=fill, RANGE=r, CALDATA=cd, $

                NDIMS=ndims, DIMS=dims, TYPE=ty
; Retrieve the information.

HELP, l, u, f, c, fill, r, cd, ndims, dims, ty
; Print information about the returned variables.

IDL prints:

L STRING = `label1'

U STRING = `unit1'

F STRING = `format1'

C STRING = `coord1'

FILL DOUBLE = 999.99103

R DOUBLE = Array(2)

CD STRUCT = -> < Anonymous > Array(1)

NDIMS LONG = 2

DIMS LONG = Array(2)

TY STRING = `DOUBLE'

PRINT, r ; Print the range.

IDL prints:

-78.000000 99.989998

PRINT, cd ; Print the calibration data.

IDL prints:

{ 1.0000000 0.10000000 2.5000000 0.10000000 6}

PRINT, dims ; Print the dimensions.

IDL prints:

10 20

HDF_SD_ENDACCESS, sds_id ; Close the SD interface.

HDF_SD_END, sd_id

See Also

HDF_SD_END , HDF_SD_ENDACCESS , HDF_SD_GETINFO , HDF_SD_START