AgCalculateAndRasterizeZoneMetrics Task

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:

; 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 properties (Set, Get): CLASSIFICATION, INPUT_RASTER, INPUT_ZONE_RASTER, INPUT_ZONES, OUTPUT_METRIC, OUTPUT_RASTER_URI, OUTPUT_ZONES_URI

Output properties (Get only): OUTPUT_RASTER, OUTPUT_ZONES

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

Methods

This task inherits the following methods from ENVITask:

AddParameter

Execute

Parameter

ParameterNames

RemoveParameter

Properties

This task inherits the following properties from ENVITask:

COMMUTE_ON_DOWNSAMPLE

COMMUTE_ON_SUBSET

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

This task also contains the following properties:

CLASSIFICATION (optional)

Set this property to true to create a classification image showing the relative pattern of a selected zone metric. The default value is false, which will create a grayscale image with the actual values of a zone metric.

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.

OUTPUT_RASTER

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

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 property, or set it to an exclamation symbol (!), a temporary file will be created.

OUTPUT_ZONES (required)

This is a reference to the output zones data.

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.

Version History

Crop Science 1.1

Introduced

Crop Science 1.1.1

Added INPUT_ZONE_RASTER property

See Also

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