PIDF UNIT DEFINITION BLOCK

The PIDF Unit Block consists of one or more structures which contain algorithms used to convert the raw UDF data into physical units. This includes algorithms which simply pass the data through with no change in value. A full discussion of the design of UDF algorithms can be found in the THE UDF ALGORITHM MANUAL. In addition the structures hold labels and other ancillary information associated with the unit conversion.

The PIDF Unit definitions are used in one way or another by all UDF based applications. GUI interfaces use them to present lists of units available for various measurments. Plotting applications often make use of the range, scaling and label information found within the structures. The defined algorithms are required by the UDF cwconvert_to_unitsid to transform the raw UDF data.

A PIDF unit definition block consists of a single field which gives the number of unit definition structures followed by the individual structures themselves, each of which contains one unit definition. A PIDF unit definition block has the generalized form:

int num_units = ENTRY;
struct UnitN {
   int    id = Entry;
   int    local_id = Entry;
   float  min = Entry;
   float  max = Entry;
   int    unit_scaling = Entry;
   string unit_label = "Entry";
   string long_description = "Entry";
   string short_description = "Entry";
   int    num_tables = Entry;
   int    tbl_app_flag = Entry;
   int    tbl_app_oper = Entry;                        
}
where N is a structure counter which begins at 0 and runs through the number of defined unit structures less 1. The fields within the structure can be entered in any order.

Not all of the above structure fields need be present in a structure defintion. Default values are supplied for any unspecified field.

KEYWORD: num_units

The number of defined Unit structures in the PIDF. There is always at least one Unit structure defined in the PIDF. This will be a definition in which the raw UDF data is returned (an algorithm containing no steps). The num_units field can be placed anywhere within the overall PIDF file above the first Unit structure definition and external to any internal PIDF structures. It is an int field.

KEYWORD: id

A unique identifier based on the physical unit defined in the Unit structure. All unit definitions having identical physical units (length, velocity, acceleration, etc) should have the same id value. This is a global (UDF-wide) designation. A list of defined id values can be found in Appendix A in the Southwest Research Institute document PIDF Documentation by Frahm et al. They are not repeated here.

This is a int field which if not included in the Unit structure is defaulted to a -1.

KEYWORD: local_id

A unique identifier which allows different unit definitions to be grouped together by an application. This is a local (PIDF-wide) designation and as such has no master list of values. The primary use of this field is by applications which try to blindly pick up all data within a PIDF which have physical units in common with a selected unit.

At first glance it might appear that this field duplicates the function of the id field but that is not the case. The local_id field is a means of distinguishing differences in origin of a common physical unit definition. For example, a unit of counts/accumulation may have a number of different sources including electron data, ion data, neutral data. The local_id field allows these sources to be separated within a single PIDF.

This is a int field which if not included in the Unit structure is defaulted to a -1 (local_id undefined).

KEYWORD: min

A reasonable minimum value for the unit definition. This can be used in scaling plotting axes or colorbars. This is a float field which if not included in the Unit structure is defaulted to -1.0e30.

KEYWORD: max

A reasonable maximum value for the unit definition. This can be used in scaling plotting axes or colorbars. This is a float field which if not included in the Unit structure is defaulted to 1.0e30.

KEYWORD: unit_scaling

A suggested scaling method to use along plotting axes or colorbars associated with the unit definition. The recognized values for thie field are:

VALUE DEFNITION
1 Linear scaling
2 Logarithmic scaling

This is a int field which if not included in the Unit structure is defaulted to a 1 (LINEAR scaling).

KEYWORD: unit_label

The label defining the physical units (km, m/sec, etc) being returned through the unit definition. This is not a description of the unit definition (length, velocity, etc) which is contained in the long_description field.

This is a string field which if not included in the Unit structure is defaulted to a NULL.

KEYWORD: long_description

A descriptive label for the physical units (length, velocity, flux, etc) being returned through the unit definition. This is not the physical units (km, m/sec, etc) associated with the unit definition which is given in the unit_label field.

This is a string field which if not included in the Unit structure is defaulted to a NULL.

KEYWORD: short_description

A short descriptive label for the physical units which is generally a decimated version of what is defined in the unit long_description field.

This is a string field which if not included in the Unit structure is defaulted to a NULL.

KEYWORD: num_tables

The number of steps contained in the unit definition algorithm. Each step in an algorithm consists of a VIDF table designation and an associated operation (see THE UDF ALGORITHM MANUAL.

This is an int field which if not included in the Unit structure is defaulted to 0.

KEYWORD: tbl_app_flag

The VIDF table number associated with one step in the unit definition algorithm. There will be num_tables occurrances of this field in the structure. The UDF algorithm proceeds from the first defined tbl_app_flag to the last in the order specified in the structure.

This is an int field.

KEYWORD: tbl_app_oper

The operation associated with one step in the unit definition algorithm. There will be num_tables occurrances of this field in the structure. There is a one to one correspondence between the tbl_app_oper fields and the tbl_app_flag fields. The fields are paired in the order they occur in the structure: the first specified tbl_app_flag field is paired with the first specified tbl_app_oper field, the second specified tbl_app_flag field is paired with the second specified tbl_app_oper field, etc.

The recognized values for this field are given in the THE UDF ALGORITHM MANUAL. NOTE: When the operation is specified symbolically rather than numerically, the symbol is not quoted.

This is an int field.

EXAMPLES

The following are examples of fully functional PIDF unit information blocks. The entries are shown within the overall PIDF definition braces which would occur only once within the PIDF file.

EXAMPLE 1

pidf v2_IMEDHSKP {
$*********************************************************************
    int num_units = 12;                              $$ no. units
    struct Unit0 {
$-------------------------UNIT 00-------------------------------------
        int id = 0;                                  $$ unit id
        float min = 0.0;                             $$ unit min/max
        float max = 33000.0;                         $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Telemetry";       $$ long desc.
        string short_description = "Raw";            $$ short desc.
        int num_tables = 0;                          $$ number of tbls
    };
    struct Unit1 {
$-------------------------UNIT 01-------------------------------------
        int id = 0;                                  $$ unit id
        float min = 0.0;                             $$ unit min/max
        float max = 5000.0;                          $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Volts";                 $$ unit label
        string long_description = "Voltage";         $$ long desc.
        string short_description = "V";              $$ short desc.
        int num_tables = 1;                          $$ number of tbls
        int tbl_app_flag = 0;                        $$ table numbers
        int tbl_app_oper = 0;                        $$ table opers
    };
    struct Unit2 {
$-------------------------UNIT 02-------------------------------------
        int id = 0;                                  $$ unit id
        float min = 1.0e-7;                          $$ unit min/max
        float max = 1.0e-4;                          $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Amps";                  $$ unit label
        string long_description = "Current";         $$ long desc.
        string short_description = "I";              $$ short desc.
        int num_tables = 1;                          $$ number of tbls
        int tbl_app_flag = 0;                        $$ table numbers
        int tbl_app_oper = 0;                        $$ table opers
    };
    struct Unit3 {
$-------------------------UNIT 03-------------------------------------
        int id = 0;                                  $$ unit id
        float min = 0.0;                             $$ unit min/max
        float max = 100.0;                           $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Volts";                 $$ unit label
        string long_description = "Voltage";         $$ long desc.
        string short_description = "V";              $$ short desc.
        int num_tables = 1;                          $$ number of tbls
        int tbl_app_flag = 0;                        $$ table numbers
        int tbl_app_oper = 0;                        $$ table opers
    };
    struct Unit4 {
$-------------------------UNIT 04-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -50.0;                           $$ unit min/max
        float max = 50.0;                            $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Degrees C";             $$ unit label
        string long_description = "Temperature";     $$ long desc.
        string short_description = "T";              $$ short desc.
        int num_tables = 1;                          $$ number of tbls
        int tbl_app_flag = 0;                        $$ table numbers
        int tbl_app_oper = 0;                        $$ table opers
    };
    struct Unit5 {
$-------------------------UNIT 05-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -1.0;                            $$ unit min/max
        float max = 4.0;                             $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Quality Flag";    $$ long desc.
        string short_description = "dQ";             $$ short desc.
        int num_tables = 0;                          $$ number of tbls
    };
    struct Unit6 {
$-------------------------UNIT 06-------------------------------------
        int id = 0;                                  $$ unit id
        float min = 0.0;                             $$ unit min/max
        float max = 1200.0;                          $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Scan Index";      $$ long desc.
        string short_description = "Scan";           $$ short desc.
        int num_tables = 0;                          $$ number of tbls
    };
    struct Unit7 {
$-------------------------UNIT 07-------------------------------------
        int id = 0;                                  $$ unit id
        float min = 0.0;                             $$ unit min/max
        float max = 1200.0;                          $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Integer";         $$ long desc.
        string short_description = "Value";          $$ short desc.
        int num_tables = 0;                          $$ number of tbls
    };
    struct Unit8 {
$-------------------------UNIT 08-------------------------------------
        int id = 0;                                  $$ unit id
        int local_id = 0                             $$ header data
        float min = 0.0;                             $$ unit min/max
        float max = 25.0;                            $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Spins";                 $$ unit label
        string long_description = "Time";            $$ long desc.
        string short_description = "Tm";             $$ short desc.
        int num_tables = 0;                          $$ number of tbls
    };
    struct Unit9 {
$-------------------------UNIT 09-------------------------------------
        int id = 0;                                  $$ unit id
        int local_id = 0                             $$ header data
        float min = 0.0;                             $$ unit min/max
        float max = 66000.0;                         $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Telemetry";       $$ long desc.
        string short_description = "Raw";            $$ short desc.
        int num_tables = 0;                          $$ number of tbls
    };
    struct Unit10 {
$-------------------------UNIT 10-------------------------------------
        int id = 0;                                  $$ unit id
        int local_id = 0                             $$ header data
        float min = 0.0;                             $$ unit min/max
        float max = 6000.0;                          $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Tics";                  $$ unit label
        string long_description = "Time";            $$ long desc.
        string short_description = "Tm";             $$ short desc.
        int num_tables = 0;                          $$ number of tbls
    };
    struct Unit11 {
$-------------------------UNIT 11-------------------------------------
        int id = 0;                                  $$ unit id
        float min = 0.0;                             $$ unit min/max
        float max = 3600.0;                          $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "degrees";               $$ unit label
        string long_description = "Time";            $$ long desc.
        string short_description = "Tm";             $$ short desc.
        int num_tables = 1;                          $$ number of tbls
        int tbl_app_flag = 0;                        $$ table numbers
        int tbl_app_oper = 1;                        $$ table opers
    };
};

EXAMPLE 2

pidf v2_IMMSTATS {
$*********************************************************************
    int num_units = 14;                              $$ no. units
    struct Unit0 {
$-------------------------UNIT 00-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -1.0;                            $$ unit min/max
        float max = 69.0;                            $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Telemetry";       $$ long desc.
        string short_description = "Raw";            $$ short desc.
        int num_tables = 2;                          $$ number of tbls
        int tbl_app_flag = 11;                       $$ table numbers
        int tbl_app_flag = 2;                        $$ table numbers
        int tbl_app_oper = 7;                        $$ table opers
        int tbl_app_oper = 5;                        $$ table opers
    };
    struct Unit1 {
$-------------------------UNIT 01-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -1.0;                            $$ unit min/max
        float max = 19.0;                            $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Telemetry";       $$ long desc.
        string short_description = "Raw";            $$ short desc.
        int num_tables = 2;                          $$ number of tbls
        int tbl_app_flag = 7;                        $$ table numbers
        int tbl_app_flag = 3;                        $$ table numbers
        int tbl_app_oper = 7;                        $$ table opers
        int tbl_app_oper = 5;                        $$ table opers
    };
    struct Unit2 {
$-------------------------UNIT 02-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -1.0;                            $$ unit min/max
        float max = 69.0;                            $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Telemetry";       $$ long desc.
        string short_description = "Raw";            $$ short desc.
        int num_tables = 1;                          $$ number of tbls
        int tbl_app_flag = 2;                        $$ table numbers
        int tbl_app_oper = 5;                        $$ table opers
    };
    struct Unit3 {
$-------------------------UNIT 03-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -1.0;                            $$ unit min/max
        float max = 129.0;                           $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Telemetry";       $$ long desc.
        string short_description = "Raw";            $$ short desc.
        int num_tables = 2;                          $$ number of tbls
        int tbl_app_flag = 9;                        $$ table numbers
        int tbl_app_flag = 1;                        $$ table numbers
        int tbl_app_oper = 7;                        $$ table opers
        int tbl_app_oper = 5;                        $$ table opers
    };
    struct Unit4 {
$-------------------------UNIT 04-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -1.0;                            $$ unit min/max
        float max = 4.0;                             $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Telemetry";       $$ long desc.
        string short_description = "Raw";            $$ short desc.
        int num_tables = 2;                          $$ number of tbls
        int tbl_app_flag = 8;                        $$ table numbers
        int tbl_app_flag = 5;                        $$ table numbers
        int tbl_app_oper = 7;                        $$ table opers
        int tbl_app_oper = 5;                        $$ table opers
    };
    struct Unit5 {
$-------------------------UNIT 05-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -1.0;                            $$ unit min/max
        float max = 69.0;                            $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Telemetry";       $$ long desc.
        string short_description = "Raw";            $$ short desc.
        int num_tables = 2;                          $$ number of tbls
        int tbl_app_flag = 6;                        $$ table numbers
        int tbl_app_flag = 2;                        $$ table numbers
        int tbl_app_oper = 7;                        $$ table opers
        int tbl_app_oper = 5;                        $$ table opers
    };
    struct Unit6 {
$-------------------------UNIT 06-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -1.0;                            $$ unit min/max
        float max = 4.0;                             $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Telemetry";       $$ long desc.
        string short_description = "Raw";            $$ short desc.
        int num_tables = 1;                          $$ number of tbls
        int tbl_app_flag = 4;                        $$ table numbers
        int tbl_app_oper = 5;                        $$ table opers
    };
    struct Unit7 {
$-------------------------UNIT 07-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -1.0;                            $$ unit min/max
        float max = 49.0;                            $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Telemetry";       $$ long desc.
        string short_description = "Raw";            $$ short desc.
        int num_tables = 2;                          $$ number of tbls
        int tbl_app_flag = 10;                       $$ table numbers
        int tbl_app_flag = 2;                        $$ table numbers
        int tbl_app_oper = 7;                        $$ table opers
        int tbl_app_oper = 5;                        $$ table opers
    };
    struct Unit8 {
$-------------------------UNIT 08-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -1.0;                            $$ unit min/max
        float max = 1024.0;                          $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Telemetry";       $$ long desc.
        string short_description = "Raw";            $$ short desc.
        int num_tables = 1;                          $$ number of tbls
        int tbl_app_flag = 0;                        $$ table numbers
        int tbl_app_oper = 5;                        $$ table opers
    };
    struct Unit9 {
$-------------------------UNIT 09-------------------------------------
        int id = 0;                                  $$ unit id
        float min = 0.0;                             $$ unit min/max
        float max = 360.0;                           $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Degrees";               $$ unit label
        string long_description = "Azimuth";         $$ long desc.
        string short_description = "Az";             $$ short desc.
        int num_tables = 3;                          $$ number of tbls
        int tbl_app_flag = 10;                       $$ table numbers
        int tbl_app_flag =  2;                       $$ table numbers
        int tbl_app_flag = 12;                       $$ table numbers
        int tbl_app_oper = 7;                        $$ table opers
        int tbl_app_oper = 5;                        $$ table opers
        int tbl_app_oper = =;                        $$ table opers
    };
    struct Unit10 {
$-------------------------UNIT 10-------------------------------------
        int id = 0;                                  $$ unit id
        float min = 0.0;                             $$ unit min/max
        float max = 360.0;                           $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Degrees";               $$ unit label
        string long_description = "Azimuth";         $$ long desc.
        string short_description = "Az";             $$ short desc.
        int num_tables = 3;                          $$ number of tbls
        int tbl_app_flag = 8;                        $$ table numbers
        int tbl_app_flag = 5;                        $$ table numbers
        int tbl_app_flag = 13;                       $$ table numbers
        int tbl_app_oper = 7;                        $$ table opers
        int tbl_app_oper = 5;                        $$ table opers
        int tbl_app_oper = =;                        $$ table opers
    };
    struct Unit11 {
$-------------------------UNIT 11-------------------------------------
        int id = 0;                                  $$ unit id
        float min = 0.0;                             $$ unit min/max
        float max = 360.0;                           $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Degrees";               $$ unit label
        string long_description = "Azimuth";         $$ long desc.
        string short_description = "Az";             $$ short desc.
        int num_tables = 7;                          $$ number of tbls
        int tbl_app_flag = 10;                       $$ table number 
        int tbl_app_flag =  2;                       $$ table number 
        int tbl_app_flag = 12;                       $$ table number 
        int tbl_app_flag =  8;                       $$ table number 
        int tbl_app_flag =  5;                       $$ table number
        int tbl_app_flag = 13;                       $$ table number
        int tbl_app_flag =  0;                       $$ table number
        int tbl_app_oper = 7;                        $$ table opers
        int tbl_app_oper = 5;                        $$ table opers
        int tbl_app_oper = =;                        $$ table opers
        int tbl_app_oper = 1007                      $$ table opers
        int tbl_app_oper = 1005                      $$ table opers
        int tbl_app_oper = 1000                      $$ table opers
        int tbl_app_oper = 2001                      $$ table opers
    };
    struct Unit12 {
$-------------------------UNIT 12-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -1.0;                            $$ unit min/max
        float max = 4.0;                             $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Integer";         $$ long desc.
        string short_description = "Val";            $$ short desc.
        int num_tables = 0;                          $$ number of tbls
    };
    struct Unit13 {
$-------------------------UNIT 13-------------------------------------
        int id = 0;                                  $$ unit id
        float min = -1.0;                            $$ unit min/max
        float max = 129.0;                           $$ unit min/max
        int unit_scaling = 1;                        $$ unit lin/log
        string unit_label = "Unitless";              $$ unit label
        string long_description = "Scan Index";      $$ long desc.
        string short_description = "SIndx";          $$ short desc.
        int num_tables = 0;                          $$ number of tbls
    };
};

&larr Previous TOC HOME Next &rarr
Image Block Sensor Block