ENVIAgCalculateGetisOrd

This function creates a Z-score raster to find regions that are statistically significant.

ENVI calculates Getis-Ord Gi* local statistics (Getis and Ord, 1992) to group neighboring pixels of similar value into clusters. The algorithm evaluates each pixel and its surrounding pixels within a specified distance to classify the pixel as "hot" or "cold" (statistically significant clusters of high or low values, respectively) or neutral (not statistically significant). Hotspot analysis can be used to look for variations in crop health.

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

Example

This example creates a Z-score raster from a spectral index image of alfalfa fields.

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 ENVIAgCalculateGetisOrd.

; 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')

 

; Calculate Getis-Ord statistics

statsImage = ENVIAgCalculateGetisOrd(MSRImage, 10)

 

; Display the result

View = e.GetView()

Layer = View.CreateLayer(statsImage)

Layer.QUICK_STRETCH = 'Equalization'

Syntax

Result = ENVIAgCalculateGetisOrd(Input_Raster, Distance [, Keywords=value])

Return Value

This function returns a reference to an ENVIRaster object.

Arguments

Input_Raster

Specify a single-band ENVIRaster object.

Distance

Specify the radius of the area around each pixel used to calculate the local mean. If the input raster has a valid spatial reference, then the radius is measured in meters. Otherwise, it is measured in pixels.

Methods

This function inherits the following methods from ENVIRaster.

Keywords

ERROR (optional)

Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

OUTPUT_FILENAME (optional)

Specify a string with the fully qualified filename and path of the output raster. If you do not set this keyword, an output file will be automatically created.

Version History

Crop Science 1.0

Introduced

See Also

AgCalculateGetisOrd Task, AgHotspotAnalysis Task, AgHotspotColorSlice Task, AgSpectralHotspotAnalysis Task