>  Docs Center  >  Crop Science  >  Calculate Zone Metrics

Calculate Zone Metrics

Calculate Zone Metrics

Use the Calculate Zone Metrics tool to create a spectral index image and to calculate statistics from it and an associated zones object (created with 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 is part of ENVI Crop Science, which requires a separate license and installation. You can also write a script to create management zones using ENVIAgCalculateAndRasterizeZoneMetricsTask.

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.
  2. Select a single-band Input Raster. It can be the same image used as input to the Create Zones tool, or it can be a different image (for example, a vegetation index) as long as it overlaps.
  3. Select an Input Zones object (.sav) that was created from the Create Zones tool.
  4. Optional: Select an Input Zone Raster if it is available. This is a classification image that corresponds to the input zones. This allows zone metrics to be calculated faster for large images.
  5. 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
  6. Set Create Classification Raster to Yes if you want to create a classification raster where zones are colored according to relative metrics. This is a good option if the input image is a spectral index image such as Normalized Difference Vegetation Index (NDVI); in this case, the classification image could be used to assess the relative health of the different zones. If you set Create Classification Raster to No, the result is a greyscale image of mean values for each zone. See the Example below.
  7. Select an output filename and location for the Output Zones Raster.
  8. 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.
  9. Select the Display result option to display the output image when processing is complete.
  10. 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.
  11. Click OK. ENVI adds the resulting output to the Data Manager and Layer Manager, and it displays the output in the Image window.


The following example uses a DEM as the basis for splitting a field into management zones. The ENVI LiDAR application was used to process point-cloud data (courtesy of the U.S. Geological Survey) into a stratified DEM with 2-meter spatial resolution. A region of interest (ROI) was drawn around a field of interest, excluding buildings. The DEM was masked and subsetted using the ROI boundary, so that the DEM covered the extent of the corn field:

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

Follow these steps to run the example:

  1. From the ENVI Toolbox, select Crop Science > Create Zones.
  2. Enter the following values in the Create Zones dialog:
    • Input Raster: Select FieldDEM.dat.
    • Number of Application Categories: 5
    • Minimum Area: 2023 square meters (1/2 acre)
    • Maximum Area: (Leave blank)
    • Primary Angle: 0 degrees
    • Output Classification Raster: AgCreateZones.dat
    • OutputZones: AgCreateZones.sav
  3. Uncheck the Preview and Display result options.
  4. Click OK.
  5. From the ENVI Toolbox, select Crop Science > Calculate Zone Metrics. The Calculate and Rasterize Zone Metrics dialog appears.
  6. In the Input Raster field, select FieldDEM.dat.
  7. In the Input Zones field, select AgCreateZones.sav.
  8. From the Output Metric drop-down list, select Zone Mean.
  9. Select the No option for Create Classification Raster.
  10. In the Output Zones Raster field, browse to a desired location to save the output raster, and accept the default filename of AgCalculateAndRasterizeZoneMetrics.dat.
  11. In the Output Zones field, browse to a desired location to save the output zones object, and accept the default filename of AgCalculateAndRasterizeZoneMetric.sav.
  12. Select the Display result option.
  13. Click OK.

The resulting image is a greyscale representation of mean elevation values for each zone. Darker zones represent lower elevations, and lighter zones represent higher elevations.

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 elevation of the black zone is 335.62 meters.

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:

One way that you could extend this example is to create an NDVI image from a multispectral or hyperspectral image of the study area, then overlay it on the mean zones image. Then you could determine if healthier plants correspond to higher or lower elevations. See Calculate Zone Metrics with Spectral Index for an example that is similar to this.

See Also

Create Zones, Calculate Zone Metrics with Spectral Index, Convert Zones to Shapefile

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