Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.

  >  Docs Center  >  Using ENVI  >  Crop Science  >  Calculate Zone Metrics with Spectral Index

Calculate Zone Metrics with Spectral Index

Calculate Zone Metrics with Spectral Index

Use the Calculate Zone Metrics with Spectral Index tool to calculate statistics for management zones from an image and a zones object created from the Create Zones tool. It creates a classification image showing the relative statistics of the zones, or a greyscale image showing the actual statistical values of the zones. This tool accepts a multispectral image as input and calculates statistics from a specified spectral index (for example, Normalized Difference Vegetation Index).

This tool is part of ENVI Crop Science, which requires a separate license and installation. You can also write a script to create management zones using ENVIAgCalculateAndRasterizeZoneMetricsWithSpectralIndexTask.

See the following sections:

Before You Begin

Before calculating zone metrics, run the Create Zones tool and specify an Output Zones file (in .sav format).

Calculate Zone Metrics

Follow these steps:

  1. From the Toolbox, select Crop Science > Calculate Zone Metrics with Spectral Index. The File Selection dialog appears.
  2. Select a multispectral input image and click OK. The Calculate Zone Metrics with Spectral Index dialog appears.
  3. Data should be in units of reflectance prior to creating spectral indices. See the Spectral Indices topic in ENVI Help for more information.

  4. Choose an option from the Spectral Index drop-down list.
  5. Select an Input Zones object (.sav) that was created from the Create Zones tool.
  6. Select the metric to calculate from the Output Metric drop-down list. The choices are:
    • Zone Minimum
    • Zone Maximum
    • Zone Mean (default)
    • Zone Standard Deviation
  7. Set Create Classification Raster to Yes if you want to create a classification raster where zones are colored according to relative metrics. If you set Create Classification Raster to No, the result is a greyscale image of mean values for each zone. See the Example below.
  8. Select an output filename and location for the Output Zones Raster.
  9. Select an output filename and location for the Output Zones. This will be a new zones object in IDL save format (.sav) with the metric added.
  10. Select the Display result option to display the output image when processing is complete.
  11. Enable the Preview check box to see a preview of the settings before you click OK to process the data. The preview is calculated only on the area in the Image window and uses the resolution level at which you are viewing the image.
  12. Click OK. ENVI adds the resulting output to the Data Manager and Layer Manager, and it displays the output in the Image window.


A common scenario is to define zones from one image, then calculate statistics for each zone from a different image. The following example uses a Moisture Stress Index (MSI) image as input to the Create Zones tool. Then it calculates the mean NDVI value for each zone, based on input from a hyperspectral image.

The following figure shows a hyperspectral image of an agricultural field. The source data were provided by the National Ecological Observatory Network (NEON), collected from the NEON imaging spectrometer, 16 July 2016, at 1-meter resolution. A region of interest (ROI) was drawn around a field of interest. The hyperspectral image was masked and subsetted using the ROI boundary, so that the image only contained pixels within the field.

Tip: This image (NEONHyperspectral1m.dat) is available in the ENVI installation path under ..\Harris\ENVIxx\data\crop_science\.

This image contains bands in the visible/near-infrared and shortwave-infrared wavelength regions, so it can be used to create spectral indices of water deficiency in vegetation. The ENVI Spectral Indices tool was used to create a Moisture Stress Index (MSI) image, shown below. Bright pixels indicate dry areas, and dark pixels indicate crops that contain an abundance of water in their leaves.

The Create Zones tool was run with the following parameters:

  • Input Raster: MSI image
  • Number of Application Categories: 5
  • Minimum Area: 1000 square meters
  • Maximum Area: Not specified
  • Primary Angle: 0 degrees
  • Output Classification Raster: AgCreateZones.dat
  • Output Zones: AgCreateZones.sav

The following figure shows the resulting zone vectors overlaid on the MSI image.

Next, the Calculate Zone Metrics with Spectral Index tool was run with the following parameters:

  • Input Raster: AgCreateZones.dat
  • Spectral Index: Normalized Difference Vegetation Index
  • Input Zones: AgCreateZones.sav
  • Output Metric: Mean
  • Create Classification Raster: Yes
  • Output Zones Raster: NDVIZoneMetricsRelativeClasses.dat
  • Output Zones: Not specified

The resulting classification raster shows the relative health of the crops in each of the five zones. The zone associated with the red class is the least healthy (based on NDVI), as indicated by the "--" label in the Layer Manager. The zone associated with the dark green class is the most healthy, as indicated by the "++" label.

Comparing this image with the MSI image shows that the least healthy zones (red and orange) roughly correspond to the driest regions in the MSI image.

The next image shows the greyscale image that results from re-running the Calculate Zone Metrics with Spectral Index tool with the Create Classification Raster option set to No. An Optimized Linear stretch was applied to the image to show the different zones.

You can view the actual pixel values of each zone by using the Cursor Value tool , or by setting any Status Bar segment to Raster Data Values (as this example shows).

As you move the cursor over a zone, the Status Bar shows the mean value (or whatever statistic you choose in the Output Metric drop-down list). In the above figure, the mean NDVI value in the white zone is 0.7.

To see the range of zone values in the entire image, right-click on the zone metrics image in the Layer Manager and select Quick Stats. Look for the Min and Max values under the Basic Stats column; for example:

See Also

Create Zones, Calculate Zone Metrics, Convert Zones to Shapefile

© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us