This procedure reads data from an ENVI Classic statistics file (.sta). The value of POS and CPOS, depending on the statistics retrieved, indicate which bands have valid statistics values.

The existence of a statistics file does not guarantee that statistics are computed for all bands. Always check POS and CPOS. In fact, a NULL statistics file may exist where POS= -1 and CPOS= -1.

## Syntax

ENVI_GET_STATISTICS, *STA_Name*, COV=*variable*, CPOS=*variable*, DMAX=*variable*, DMIN=*variable*, EVAL=*variable*, EVEC=*variable*, MEAN=*variable*, POS=*variable*, STDV=*variable*

## Arguments

### STA_Name

This is the filename of an ENVI Classic statistics file (.sta).

## Keywords

### COV

Set this keyword to specify a named variable that contains the covariance for the image. If COV is undefined, the covariance was not calculated. COV is a [*nb*, *nb*] array, where *nb* is defined by CPOS.

### CPOS

Set this keyword to specify a named variable that contains the array of band indices used to calculate COV, EVAL, and EVEC. The value of CPOS can be [-1], in which case COV, EVAL, and EVEC are invalid.

### DMAX

Set this keyword to specify a named variable that contains the image maximums. If DMAX is undefined, the basic statistics were not calculated. DMAX is a [*nb*] array, where *nb* is defined by POS.

### DMIN

Set this keyword to specify a named variable that contains the image minimum. If DMIN is undefined, the basic statistics were not calculated. DMIN is a [*nb*] array, where *nb* is defined by POS.

### EVAL

Set this keyword to specify a named variable that contains the eigenvalues for the image. If EVAL is undefined, the eigenvalues were not calculated. EVAL is a [*nb*, *nb*] array, where *nb* is defined by CPOS.

### EVEC

Set this keyword to specify a named variable that contains the eigenvectors for the image. If EVEC is undefined, the eigenvectors were not calculated. EVEC is a [*nb*, *nb*] array, where *nb* is defined by CPOS.

### MEAN

Set this keyword to specify a named variable that contains the image mean. If MEAN is undefined, the basic statistics were not calculated. MEAN is a [*nb*] array, where *nb* is defined by POS.

### POS

Set this keyword to specify a named variable that contains the array of band indices used to calculate basic statistics, DMIN, DMAX, MEAN, and STD. The value of POS can be [-1], in which case DMIN, DMAX, MEAN and STD are invalid.

### STDV

Set this keyword to specify a named variable that contains the image standard deviation. If STDV is undefined, the basic statistics were not calculated. STDV is a [*nb*] array, where *nb* is defined by POS.

## Example

This example calculates statistics from the file myimage.sta and prints the minimum, maximum, and mean for each band for which statistics were calculated.

envi_get_statistics, '/data/myimage.sta', mean=mean, $

dmax=dmax, dmin=dmin, pos=pos

if (pos[0] eq -1) then return

for i=0, n_elements(pos)-1 do $

print, 'Band ', pos[i], dmin[i], dmax[i], mean[i]

## API Version

3.2