ENVIAgCalculateAndRasterizeZoneMetricsWithSpectralIndexTask
This task creates a spectral index image and calculates statistics from it and an associated ENVIAgZones object. It creates a classification raster showing the relative statistics of the zones or a greyscale raster showing the actual statistical values of the zones.
ENVIAgCalculateAndRasterizeZoneMetricsWithSpectralIndexTask is a metatask that automatically runs the following tasks:
This task is part of ENVI Crop Science, which requires a separate license and installation.
Example
This example:
- Opens a hyperspectral raster.
- Creates a Moisture Stress Index raster from the hyperspectral raster.
- Runs ENVIAgCreateZonesTask to create zones from the Moisture Stress Index raster.
- Runs ENVIAgCalculateAndRasterizeZoneMetricsWithSpectralIndexTask using the hyperspectral image as input.
- Computes mean Normalized Difference Vegetation Index (NDVI) values for each zone.
- Displays a classification image showing the relative NDVI means for each zone.
The hyperspectral source data were provided by the National Ecological Observatory Network (NEON). The hyperspectral image was previously subsetted and masked to include a single agricultural field.
e = ENVI()
File = Filepath('NEONHyperspectral1m.dat', $
Subdir=['data','crop_science'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
indexTask = ENVITask('SpectralIndex')
indexTask.INPUT_RASTER = Raster
indexTask.INDEX = 'Moisture Stress Index'
indexTask.Execute
MSIRaster = indexTask.OUTPUT_RASTER
zonesTask = ENVITask('AgCreateZones')
zonesTask.INPUT_RASTER = MSIRaster
zonesTask.MINIMUM_AREA = 1000
zonesTask.NUMBER_OF_APPLICATION_CATEGORIES = 4
zonesTask.Execute
Task = ENVITask('AgCalculateAndRasterizeZoneMetricsWithSpectralIndex')
Task.INPUT_RASTER = Raster
Task.INDEX = 'Normalized Difference Vegetation Index'
Task.CLASSIFICATION = 'true'
Task.INPUT_ZONES = zonesTask.OUTPUT_ZONES
Task.INPUT_ZONE_RASTER = zonesTask.OUTPUT_RASTER
Task.Execute
DataColl = e.Data
DataColl.Add, Task.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(MSIRaster)
Layer2 = View.CreateLayer(Task.OUTPUT_RASTER)
View.Zoom, 3.0
Syntax
Result = ENVITask('AgCalculateAndRasterizeZoneMetricsWithSpectralIndex')
Input properties (Set, Get): CLASSIFICATION, INDEX, 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 "Init" are applied only during the initial creation of the object. Properties marked as "Set" are those that you can set to specific values after the object has been created. 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. See the ENVITask topic in ENVI Help.
- AddParameter
- Execute
- Parameter
- ParameterNames
- RemoveParameters
Properties
This task inherits the following properties from ENVITask:
COMMUTE_ON_DOWNSAMPLE
COMMUTE_ON_SUBSET
DESCRIPTION
DISPLAY_NAME
NAME
REVISION
See the ENVITask topic in ENVI Help for details.
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 greyscale image with the actual values of a zone metric.
INDEX (required)
Specify a string indicating the spectral index from which to calculate zone metrics. See the ENVISpectralIndexRaster topic in ENVI Help for a full list of spectral indices. You can also run ENVIQuerySpectralIndicesTask to see what indices are available for your particular image.
INPUT_RASTER (required)
Specify a multispectral 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 (required)
Specify one of the following strings, indicating the metric that the output raster will be based on.
- Zone Minimum
- Zone Maximum
- Zone Mean (default)
- Zone Standard Deviation
OUTPUT_RASTER
This is a reference to the output zones classification raster or greyscale raster.
OUTPUT_RASTER_URI (optional)
Specify a string with the fully qualified filename and path of the output raster. If you do not specify this property, the output raster is only temporary. Once the raster has no remaining references, ENVI deletes the temporary file.
OUTPUT_ZONES
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
|
1.1
|
Introduced
|
|
1.1.1
|
Added INPUT_ZONE_RASTER property
|
See Also
ENVIAgZones, ENVIAgCreateZonesTask, ENVIAgCalculateAndRasterizeZoneMetricsTask, ENVIAgCalculateZoneMetricsTask, ENVIAgRasterizeZonesTask, ENVIAgConvertZonesToShapefileTask