| convert_to_units (1) | UDF PROGRAMMERS MANUAL | convert_to_units (1) |
|---|
SYNOPSIS
| #include "libbase_udf.h" | ||
| ByTe_2 | convert_to_units | (u_ByTe_4 Key, ByTe_1 *Ext, u_ByTe_2 Ver, void *UDF, ByTe_1 DataField, ByTe_1 AncOrMode, ByTe_1 NAS, ByTe_1 *Tbls, ByTe_2 *Ops, ReaL_4 RetData, ByTe_1 ChkForFill, ByTe_4 Fill); |
INPUT DEFINITIONS
| Key | - | UDF data key | ||||||||||||
| Ext | - | UDF file extension | ||||||||||||
| Ver | - | Version number | ||||||||||||
| UDF | - | General data structure | ||||||||||||
| DataField | - | Type of data to be converted | ||||||||||||
| ||||||||||||||
| AncOrMode | - | Ancillary data set number or status byte number | ||||||||||||
| NAS | - | Number of algorithm steps in conversion | ||||||||||||
| Tbls | - | VIDF tables to use in each algorithm step | ||||||||||||
| Ops | - | Operations to perform at each algorithm step | ||||||||||||
| RetData | - | Converted data | ||||||||||||
| ChkFill | - | Remove fill data flag | ||||||||||||
| ||||||||||||||
| Fill | - | The fill value to check for |
DESCRIPTION convert_to_units() takes the raw UDF DataField obtained in the last read_drec() call with UDF to floating point data. If converting either MODE or ANCILLARY data then the VIDF mode number or the VIDF ancillary data set number must be supplied in AncOrMode.
In the conversion process the raw UDF data is passed through a transformation algorithm which may do as little as just return the raw input data or may convert the data into physical units. The conversion algorithm consists of a number of algorithm steps (NAS), each step consisting of the an operation (Ops) applied possibly in conjuntion with information contained in one of the VIDF tables (Tbls). When no table is used with a given algorithm step it's value in the Tbls array should be set to 0. To simply pass the raw UDF data back set NAS to 0.
The converted UDF data is returned to the calling environment in RetData. The user is responsible for ensuring that RetData is large enough to handle all of the returned data. RetData will be double precision if Datafield is set to DSENSOR, DSCAN_INDEX, DANCILLARY, or DMODE. It is single precision in all other options. When returning double precision data, the pointer to the return array is cast to a single precision pointer (ReaL_4 *) on input.
If ChkFill is set then prior to conversion the raw UDF data will be checked against Fill. Raw data found matching this value will be set to OUTSIDE_MIN.
Under normal conditions Ext should be set to a NULL string. Setting Ext to a non-NULL string will cause the file_pos routine to attempt to use the appropriate named UDF header and data files but with the string .Ext appended to it. The file must exist in the current working directory.
RETURN VALUE On success, ALL_OKAY is returned, otherwise an error code is returned.
ERRORS CNVT_NOT_FILLED No opened file (file_open not called?) CNVT_BAD_DTYPE Unknown DataField value CNVT_BAD_TBL_NUM Table number larger than number of tables CNVT_TMP_MALLOC Malloc error in setting up tmp space
APPLICABLE FORMATS UDF V2.2, IDFS V2.1
RESTRICTIONS None
SEE ALSO ret_codes(1H) user_defs(1) read_drec (1)
| UDF V2.2 | July 31, 1999 | UDF V2.2 |
|---|