HDF_SD_SETINFO

Syntax | Arguments | Keywords | Examples | Version History | See Also

The HDF_SD_SETINFO procedure sets information about an SD dataset.

Warning
Setting a label, unit, format, or coordinate system string that has more than 256 characters can have unpredictable results.

Syntax

HDF_SD_SETINFO, SDdataset_id [, CALDATA=structure] [, COORDSYS=string] [, FILL=value] [, FORMAT=string] [, LABEL=string] [, RANGE=[max, min]] [, UNIT=string]

Arguments

SDdataset_id

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

Keywords

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:

Table 4-10: HDF Number Types vs. IDL Data Types

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.

COORDSYS

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

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.

Examples

; Open an HDF file: 
SDinterface_id = HDF_SD_START('demo.hdf', /RDWR) 
; Define a new dataset for the file: 
SDdataset_id = HDF_SD_CREATE(SDinterface_id, 'variable1', [10, 
20], /DOUBLE) 
; Create a calibration data structure: 
CAL={Cal:1.0D, Cal_Err:0.1D, Offset:2.5D, Offset_Err:0.1D, $ 
   Num_Type:6L} 
; Set information about the dataset: 
HDF_SD_SETINFO, SDdataset_id, LABEL='label1', unit='unit1', $ 
   format='format1', coordsys='coord1', FILL=999.991, $ 
   RANGE=[99.99,-78], caldata=CAL 
; Retrieve the information: 
HDF_SD_GETINFO, SDdataset_id, LABEL=l, UNIT=u, FORMAT=f, $ 
   COORDSYS=c, FILL=fill, RANGE=r, CALDATA=cd, $ 
   NDIMS=ndims, DIMS=dims, TYPE=ty 
; Print information about the returned variables: 
HELP, l, u, f, c, fill, r, cd, ndims, dims, ty 
; Print the range: 
PRINT, r 
; Print the calibration data: 
PRINT, cd 
; Print the dimensions: 
PRINT, dims 
; Close the SD interface: 
HDF_SD_ENDACCESS, SDdataset_id 
HDF_SD_END, SDinterface_id 

IDL Output

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' 
 
-78.000000 99.989998  
 
{ 1.0000000 0.10000000 2.5000000 0.10000000 6}  
 
10 20 

Version History

4.0

Introduced

See Also

HDF_SD_END, HDF_SD_ENDACCESS, HDF_SD_GETINFO, HDF_SD_START