Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


Harris Geospatial / Docs Center / ENVI API / Crop Science / ENVIAgHotspotColorSliceTask

ENVIAgHotspotColorSliceTask

ENVIAgHotspotColorSliceTask

This task creates a classification raster based on color slices that represent relative Z-scores calculated from Getis-Ord Gi* hotspot analysis.

This task is part of ENVI Crop Science, which requires a separate license and installation.

Example


This example first creates a Z-score raster from a spectral index image of alfalfa fields. It then creates a classification raster with color slices that represent the relative Z-scores.

The source image consists of layer-stacked Sentinel-2A visible, near-infrared, and shortwave-infrared bands with a spatial resolution of 10 meters. The image is from eastern Idaho, USA. The accompanying region of interest (ROI) file encompasses alfalfa fields. It is used to mask out all non-alfalfa pixels from the source image. The masked raster is then used to create a Modified Simple Ratio index, which is used as input to the Getis-Ord statistics calculation.

; Start the application
e = ENVI()
 
; Open an input file
File = Filepath('CircularFields_Sentinel2A.dat', $
  Subdir=['data', 'crop_science'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Only process the actively growing fields
; using an ROI mask
ROIFile = Filepath('CircularFields_AlfalfaROI.xml', $
  Subdir=['data', 'crop_science'], $
  Root_Dir=e.Root_Dir)
ROI = e.OpenROI(ROIFile)
maskedRaster = ENVIROIMaskRaster(Raster, ROI)
 
; Create a Modified Simple Ratio index
MSRImage = ENVISpectralIndexRaster(maskedRaster, 'MSR')
 
; Create a Z-score raster
GetisOrdTask = ENVITask('AgCalculateGetisOrd')
GetisOrdTask.INPUT_RASTER = MSRImage
GetisOrdTask.DISTANCE = 10 ; meters
GetisOrdTask.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
GetisOrdTask.Execute
 
; Get the color slice task from the catalog of ENVITasks
Task = ENVITask('AgHotspotColorSlice')
 
; Define the task inputs
Task.INPUT_RASTER = GetisOrdTask.OUTPUT_RASTER
 
; Define task outputs
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
 
; Run the task
Task.Execute
 
; Get the collection of data objects currently
; available in the Data Manager
DataColl = e.Data
 
; Add the output to the Data Manager
DataColl.Add, Task.OUTPUT_RASTER
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)

Syntax


Result = ENVITask('AgHotspotColorSlice')

Input properties (Set, Get): INPUT_RASTER, OUTPUT_RASTER_URI

Output properties (Get only): DESCRIPTION, NAME, OUTPUT_RASTER

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. See the ENVITask topic in ENVI Help.

  • AddParameter
  • Execute
  • Parameter
  • ParameterNames
  • RemoveParameters

Properties


DESCRIPTION

This property describes the task.

INPUT_RASTER (required)

Specify a single-band raster.

NAME

This property contains the name of the task.

OUTPUT_RASTER

This is a reference to the output hotspot analysis color slice raster of filetype ENVI.

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.

Version History


1.0

Introduced

See Also


ENVISpectralHotspotAnalysisTask, ENVIAgCalculateGetisOrdTask



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us