[Back to Interface] [Prev] [Next]

DFSDsetcal/dsscal

intn DFSDsetcal(float64 cal, float64 cal_err, float64 offset, float64 offset_err, int32 data_type)

cal

IN:

Calibration factor

cal_err

IN:

Calibration error

offset

IN:

Uncalibrated offset

offset_err

IN:

Uncalibrated offset error

data_type

IN:

Data type of uncalibrated data

Purpose

Sets the calibration information associated with data

Return value

Returns SUCCEED (or 0) if successful and FAIL (or -1) otherwise.

Description

This routine sets the calibration record associated with a dataset. A calibration record contains four 64-bit floating point values followed by a 32-bit integer, to be interpreted as follows:

cal calibration factor

cal_err calibration error

offset uncalibrated offset

offset_err uncalibrated offset error

data_type data type of uncalibrated data

The relationship between a value iy stored in a dataset and the actual value y is defined as:

y = cal * (iy - offset)

The variable offset_err contains a potential error of offset, and cal_err contains a potential error of cal. Currently the calibration record is provided for information only. The SD interface performs no operations on the data based on the calibration tag.

DFSDsetcal works like other DFSDset* routines, with one exception: the calibration information is automatically cleared after a call to DFSDputdata or DFSDadddata. Hence, DFSDsetcal must be called again for each dataset that is to be written.

As an example, suppose the values in a dataset y[] are as follows:

y[6]={1001.0, 1002.0, 1002.5, 1005.5, 1013.0, 1040.5}

By defining cal = 0.50 and offset = -200.0 and applying the calibration formula, the calibrated dataset iy[] becomes as follows:

iy[6]={2, 4, 5, 11, 26, 81}

The array iy[] can then be stored as integers.

FORTRAN

integer function dsscal(cal, cal_err, offset, offset_err, data_type)

real*8 cal, cal_err, offset, offset_err

integer data_type



[Back to Interface] [Prev] [Next]

hdfhelp@ncsa.uiuc.edu
HDF Reference Manual - 04/08/98, NCSA HDF Development Group.