This routine is obsolete and has been replaced with the QuerySpectralIndices task.

This function returns the number of vegetation indices that can be calculated on an input data file. It can optionally return the names of these indices, a classification describing the purpose of the index, or, if no indices are available, a descriptive error specifying the reason why.

Syntax


Result = ENVI_VEG_INDEX_AVAILABLE_INDICES (FID [, ERROR_STRING=string] [, VI_LIST=array] [, VI_NAMES=string] [, VI_TYPE=array])

Arguments


FID

Use this keyword to specify the file ID for the input file.

Keywords


ERROR_STRING (optional)

Set this keyword to a named variable in which to return a descriptive error string describing the reason that no vegetation indices are available, if the return value of the function is 0. Otherwise, this keyword is undefined.

VI_LIST (optional)

Set this keyword to a named variable in which to return an array of long integers containing the numeric indices associated with each vegetation index available for calculation, if any. These indices can be used to specify the desired subset of indices for the ENVI_VEG_INDEX_DOIT procedure to calculate. If the ENVI_VEG_INDEX_AVAILABLE_INDICES return value is 0, this keyword is undefined.

VI_NAMES (optional)

Set this keyword to a named variable in which to return a string array containing the names of all vegetation indices available for calculation, if any. If the ENVI_VEG_INDEX_AVAILABLE_INDICES return value is 0, this keyword is undefined.

VI_TYPE (optional)

Set this keyword to a named variable in which to return a string containing the names of the categories for all vegetation indices available for calculation. If the ENVI_VEG_INDEX_AVAILABLE_INDICES return value is 0, this keyword is undefined.

Example


The following example code shows how to calculate a subset of VIs.

PRO EXAMPLE_VEG_INDEX_2
  compile_opt IDL2  
  ;
  ; This example calculates a subset of the available vegetation 
  ; indices determined using both   
  ; the ENVI_VEG_INDEX_AVAILABLE_INDICES procedure   
  ; and the ENVI_VEG_INDEX_DOIT procedure  
  ; First, restore all the base save files.
  ;
  envi, /restore_base_save_files  
  ;
  ; Initialize ENVI and send all errors  
  ; and warnings to the file batch.txt.
  ;
  envi_batch_init, log_file='batch.txt'
  ;
  ; Open the input file
  ;
  envi_open_file, envi_pickfile(), r_fid=fid  
  if (fid eq -1) then begin
  envi_batch_exit    
  return
  endif
  ;
  ; Find the list of available vegetation indices for this file.  
  if (~ENVI_VEG_INDEX_AVAILABLE_INDICES(fid, vi_list=vi_list, $               
     vi_names=vi_names, vi_type=vi_type, $
     error_string=error_string)) then begin    
     print, error_string    
     envi_batch_exit    
     return
  endif  
  ;
  ; Find the subset of indices for greenness to calculate.  
  ;
  vi_subset = where(vi_type eq 'Broadband Greenness', count)  
  if (count eq 0) then begin    
     print, 'Error: No broadband greenness indices are available.'    
     envi_batch_exit    
     return  
  endif  
  ;
  ; Calculate the greenness indices.  
  ;
  envi_doit, 'envi_veg_index_doit', fid=fid, in_memory=0, $             
     out_name='veg_indices.dat', vi_list=vi_list[vi_subset]
  ;
  ; Exit ENVI
  ;  
  envi_batch_exit
END