NCL Home > Documentation > HLUs > User Guide

Resource types

Every resource has one of the following basic types:

  • Integer
  • Real
  • String
  • Enumerated (a number represents a string)
  • Array
  • 2D array
These string values for these types and enumerations are defined in the HLU library and listed in the HLU types module. The HLU library also contains many enumeration values; these are listed in the HLU enumeration values table.

Resources that have an enumerated type can be set using the SetInteger function with the enumerated value or the integer value, or using the SetString function with the string value. Note that the set of characters that are enclosed in quotes in the C comment field is the string representation of the enumerated value. This string value can be used in the SetString function, and the string value is case insensitive.

For example, the cnConstFLabelFontQuality resource has a type NhlTFontQuality. NhlTFontQuality is an enumerated type defined as follows:

    typedef enum {
        NhlHIGH         = 0,    /* "High"       */
        NhlMEDIUM       = 1,    /* "Medium"     */
        NhlLOW          = 2     /* "Low"        */
    } NhlFontQuality;
So, for example, the resource could be set (in C) to "Medium" in any of 3 ways:

  1. NhlRLSetString(list_id, "cnConstFLabelFontQuality", "Medium");
  2. NhlRLSetInteger(list_id, "cnConstFLabelFontQuality", NhlMEDIUM);
  3. NhlRLSetInteger(list_id, "cnConstFLabelFontQuality", 1);

Where "list_id" is the integer id of the resource list to add the name/value pair to.

Since the C enumeration values cannot be used in FORTRAN programs, FORTRAN programmers would have to use one of the following calls to set the cnConstFLabelFontQuality resource:

NhlFRLSetString(list_id, 'cnConstFLabelFontQuality','Medium', ierr)
NhlFRLSetInteger(list_id, 'cnConstFLabelFontQuality', 1, ierr)

where "list_id" is the integer id of the resource list to add the name/value pair to, and "ierr" is the integer value error code that is returned by the function.

See also: