This topic describes the elements of the Syntax section in the help topics for routines and methods used in ENVI programming.

Consider the following syntax statement from ENVIView::CreateLayer:

Result = view.CreateLayer(Raster [, BANDS=array] [, /CIR] [, /CLEAR_DISPLAY]
[, ERROR=variable])

The ENVIView object's CreateLayer function method creates and returns a new ENVIRasterLayer object. In this syntax statement:

  • Result is the returned object and is italicized.
  • view is the ENVIView object and is italicized.
  • CreateLayer is the name of the function method.
  • Arguments and keywords to the CreateLayer function are enclosed within parentheses.
  • Raster is an argument and is italicized. Arguments are positional parameters that you must supply in the order indicated by the routine’s syntax. Some arguments are optional.
  • [, BANDS=array] and [, ERROR=variable] are optional keywords that are set to some value. The square brackets indicate they are optional. BANDS is set to an array that is passed in, and ERROR is set to a named variable that will contain the returned value. Do not include the actual brackets when executing the command. You can specify keywords in any order.
  • [, /CIR] and [, /CLEAR_DISPLAY] are optional Boolean keywords. When the documentation says, “Set this keyword to load a Color Infrared (CIR) image,” the keyword is a switch that turns an option on or off. Usually, setting such keywords equal to 1 turns on the option. Explicitly setting the keyword to 0 (or not including the keyword) turns off the option. But you can use a shortcut to set a keyword equal to 1 by prefacing it with a forward slash ("/").

At the command line or in a batch program, you would enter something similar to the following:

layer = view.CreateLayer(raster1, /CIR)

The following sections describe some of these concepts in more detail.

Italics


Italicized words are arguments, expressions, or statements for which you must provide values. The value you provide can be a numerical value, an expression, or a named variable.

Brackets


Pay close attention to the grouping of square brackets. Consider the following examples:

ROUTINE_NAME, Value1 [, Value2] [, Value3]: You must specify Value1, but you do not have to specify Value2 or Value3. You can specify Value2 and Value3 independently.

ROUTINE_NAME, Value1 [, Value2, Value3]: You must specify Value2 and Value3 together, or neither.

ROUTINE_NAME [, Value1 [, Value2]]: You can specify Value1 without specifying Value2, but if you specify Value2, you must also specify Value1.

Do not include the actual brackets in your statement unless the brackets are italicized, in which case you should include them in your call to specify an array.

Braces


For certain keywords, a list of the possible values is provided. This list is enclosed in braces, and the choices are separated by a vertical line ( | ). Do not include the braces in your statement. Consider the following syntax:

[, DTED_LEVEL={0|1|2}]

If you set the optional DTED_LEVEL keyword, you must choose either 0, 1, or 2.

Braces are used to enclose the allowable range for a keyword value. Unless otherwise noted, provided ranges are inclusive. Consider the following syntax:

[, THRESHOLD=value{0 to 255}]

If you set the optional THRESHOLD keyword, a valid example would be THRESHOLD=150.

Certain keywords are prefaced by X, Y, or Z. Braces are used for these keywords to indicate that you must choose one of the values it contains. For example, [{X | Y}RANGE=array] indicates that you can specify either XRANGE=array or YRANGE=array.

Do not include the braces or their content in your statement.

Procedures


Procedures have the syntax:

Object.method, Argument [, KEYWORD]

where Object is the name of the object, method is the method acting on that object, Argument is a required parameter, and KEYWORD is an optional keyword parameter to the procedure.

At the command line or in a batch program, you would enter something similar to the following for ENVIView::Pan:

view.pan, 15, /ERROR

Named Variables


Often, arguments and keywords that contain values upon return from the function are described as accepting named variables. A named variable is a valid IDL variable name. You do not need to define this variable before using it as an output argument or with a keyword.