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 parameters (Set, Get): INPUT_RASTER, INPUT_ZONE_RASTER, INPUT_ZONES, OUTPUT_ZONES_URI

Output parameters (Get only): 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_ZONES_URI (optional)

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

Output Parameters


OUTPUT_ZONES

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

  • 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

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, AgCalculateAndRasterizeZoneMetrics Task, AgRasterizeZones Task, AgConvertZonesToShapefile Task