This task calculates statistics from a single-band raster and an associated ENVIAgZones object. It creates a classification raster showing the relative values of zones or a grayscale raster showing actual statistical values of zones.

AgCalculateAndRasterizeZoneMetrics Task is a metatask that automatically runs the following tasks:

This task requires a separate license for the ENVI Crop Science Module; contact your sales representative for more information.

Example


This example:

  • Uses a DEM as the basis for splitting a field into five management zones.
  • Runs AgCreateZones Task to create the zones.
  • Runs AgCalculateAndRasterizeZoneMetrics Task and displays a grayscale image of mean elevation values for each zone.
; Start the application
e = ENVI()
 
; Open a DEM file
File = Filepath('FieldDEM.dat', $
  Subdir=['data','crop_science'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Create a zones object
zonesTask = ENVITask('AgCreateZones')
zonesTask.INPUT_RASTER = Raster
zonesTask.MINIMUM_AREA = 2023
zonesTask.NUMBER_OF_APPLICATION_CATEGORIES = 5
zonesTask.Execute
 
; Calculate and rasterize zone metrics
Task = ENVITask('AgCalculateAndRasterizeZoneMetrics')
Task.INPUT_RASTER = Raster
Task.INPUT_ZONES = zonesTask.OUTPUT_ZONES
Task.INPUT_ZONE_RASTER = zonesTask.OUTPUT_RASTER
Task.Execute
 
; Get the collection of objects currently in the Data Manager
DataColl = e.Data
 
; Add the output to the data collection
DataColl.Add, Task.OUTPUT_RASTER
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)

Syntax


Result = ENVITask('AgCalculateAndRasterizeZoneMetrics')

Input parameters (Set, Get): INPUT_RASTER, INPUT_ZONE_RASTER, INPUT_ZONES, OUTPUT_METRIC, OUTPUT_RASTER_URI, OUTPUT_ZONES_URI

Output parameters (Get only): OUTPUT_RASTER, OUTPUT_ZONES

Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.

Input Parameters


INPUT_RASTER (required)

Specify a single-band raster from which zone metrics will be computed.

INPUT_ZONE_RASTER (optional)

Specify the zone classification raster that corresponds to the input zones. It allows metrics to be calculated faster for large images.

INPUT_ZONES (required)

Specify an input ENVIAgZones object.

OUTPUT_METRIC (optional)

Specify one of the following strings, indicating the metric that the output raster will be based on.

  • Zone Mean (default)
  • Zone Maximum
  • Zone Minimum
  • Zone Standard Deviation

OUTPUT_RASTER_URI (optional)

Specify a string with the fully qualified filename and path of the associated OUTPUT_RASTER.

  • If you do not specify this parameter, or set it to an exclamation symbol (!), ENVI creates a temporary file.
  • If you set it to the hash symbol (#), ENVI creates a file in the temporary directory, but this file will not be deleted when ENVI closes.

OUTPUT_ZONES_URI (optional)

Specify a string with the fully qualified filename and path for the output .sav file that will contain the zones data.

Output Parameters


OUTPUT_RASTER

This is a reference to the output zones classification raster or grayscale raster.

OUTPUT_ZONES

This is a reference to the output zones data.

Methods


Execute

Parameter

ParameterNames

Properties


DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History


Crop Science 1.1

Introduced

Crop Science 1.1.1

Added INPUT_ZONE_RASTER parameter

See Also


ENVIAgZones, AgCreateZones Task, AgCalculateAndRasterizeZoneMetricsWithSpectralIndex Task, AgCalculateZoneMetrics Task, AgRasterizeZones Task, AgConvertZonesToShapefile Task