This task calculates statistics on individual zones contained in an ENVIAgZones object.

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. The example uses AgCreateZones Task to create the zones, then it calculates and prints metrics for each zone.

; Start the application
e = ENVI(/HEADLESS)
 
; 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 zone metrics
metricsTask = ENVITask('AgCalculateZoneMetrics')
metricsTask.INPUT_RASTER = Raster
metricsTask.INPUT_ZONES = zonesTask.OUTPUT_ZONES
metricsTask.INPUT_ZONE_RASTER = zonesTask.OUTPUT_RASTER
metricsTask.Execute
outZones = metricsTask.OUTPUT_ZONES
 
; Print the properties of the output zones object
Print, outZones

Syntax


Result = ENVITask('AgCalculateZoneMetrics')

Input properties (Set, Get): INPUT_RASTER, INPUT_ZONE_RASTER, INPUT_ZONES, OUTPUT_ZONES_URI

Output properties (Get only): 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:

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_ZONES (required)

This is a reference to the output ENVIAgZones object. In addition to the standard ENVIAgZone properties, the output object will contain the following attributes:

  • SOURCE_RASTER_NCOLUMNS: The number of columns in the source raster
  • SOURCE_RASTER_NROWS: The number of rows in the source raster
  • SOURCE_RASTER_SPATIALREF: The spatial reference of the source raster
  • ZONE_MAX: The maximum pixel value for each zone
  • ZONE_MEAN: The mean pixel value for each zone
  • ZONE_MIN: The minimum pixel value for each zone
  • ZONE_STDEV: The standard deviation pixel value for each zone

OUTPUT_ZONES_URI (optional)

Specify a string with the fully qualified filename and path of the output zones.

Version History


Crop Science 1.1

Introduced

Crop Science 1.1.1

Added INPUT_ZONE_RASTER property

See Also


ENVIAgZones, AgCreateZones Task, AgCalculateAndRasterizeZoneMetrics Task, AgRasterizeZones Task, AgConvertZonesToShapefile Task