This routine is obsolete and has been replaced with the SpectralIndex and SpectralIndices tasks.

Use this procedure to calculate vegetation indices from a spectral input image. The input spectral data must be atmospherically corrected and calibrated to reflectance.


ENVI_DOIT, 'ENVI_VEG_INDEX_DOIT' [, /CROSS_CHECK] [, DIMS=array], FID=file ID [, /IN_MEMORY] [, M_FID=file ID] [, M_POS=value] [, OUT_NAME=string] [, R_FID=file ID] [, VI_LIST=string]



Set this keyword to perform biophysical cross-checking on the output. Biophysical cross-checking performs pixel-by-pixel comparisons between the vegetation indices to determine areas where one index value indicates that another index value has a low probability of validity. The values for any pixel with a low probability of validity are set to the data ignore value. The default is to not perform biophysical cross-checking.

DIMS (optional)

The “dimensions” keyword is a five-element array of long integers that defines the spatial subset (of a file or array) to use for processing. Nearly every time you specify the keyword FID, you must also specify the spatial subset of the corresponding file (even if the entire file, with no spatial subsetting, is to be processed).

  • DIMS[0]: A pointer to an open ROI; use only in cases where ROIs define the spatial subset. Otherwise, set to -1L.
  • DIMS[1]: The starting sample number. The first x pixel is 0.
  • DIMS[2]: The ending sample number
  • DIMS[3]: The starting line number. The first y pixel is 0.
  • DIMS[4]: The ending line number

To process an entire file (with no spatial subsetting), define DIMS as shown in the following code example. This example assumes you have already opened a file using ENVI_SELECT or ENVI_PICKFILE:

  envi_file_query, fid, dims=dims


The file ID (FID) is a long-integer scalar with a value greater than 0. An invalid FID has a value of -1. The FID is provided as a named variable by any routine used to open or select a file. Often, the FID is returned from the keyword R_FID in the ENVIRasterToFID routine. Files are processed by referring to their FIDs. If you work directly with the file in IDL, the FID is not equivalent to a logical unit number (LUN).

IN_MEMORY (optional)

Set this keyword to specify that output should be stored in memory. If you do not set IN_MEMORY, output will be stored on disk and you must specify OUT_NAME (see below).

M_FID (optional)

Use this keyword to specify the file ID of the mask file. This value is returned from the keyword R_FID in the ENVI_OPEN_FILE procedure. M_FID is a long integer with a value greater than 0. An invalid file ID has a value of -1.

M_POS (optional)

Use this keyword to specify the band position of the mask band. M_POS is a long integer with a value greater than or equal to 0.

OUT_NAME (optional)

Use this keyword to specify a string with the output filename for the resulting data. If you set the keyword IN_MEMORY, you do not need to specify OUT_NAME.

R_FID (optional)

ENVI Classic library routines that result in new images also have an R_FID, or “returned FID.” This is simply a named variable containing the file ID to access the processed data. Specifying this keyword saves you the step of opening the new file from disk.

VI_LIST (optional)

Use this keyword to indicate which vegetation indices to calculate. Each vegetation index is specified as a numeric index into the array of all available vegetation indices. This list is derived from the VI_LIST values returned from the ENVI_VEG_INDEX_AVAILABLE_INDICES function. The default is to calculate all available vegetation indices. If any indices are requested that cannot be calculated on the input dataset, only the available requested indices will be calculated, unless you are in an interactive ENVI Classic session, in which case you are prompted if the valid selected indices should be calculated.