This task creates a spectral index image and runs hotspot analysis on it to look for areas that are statistically significant from surrounding areas. The resulting image shows the most significant features for the index.
AgSpectralHotspotAnalysis Task is a metatask that runs the following tasks:
This task requires a separate license for the ENVI Crop Science Module; contact your sales representative for more information.
Example
This example creates a hotspot image that shows the relative health of alfalfa crops.
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 calculate a Modified Simple Ratio index.
e = ENVI()
File = Filepath('CircularFields_Sentinel2A.dat', $
Subdir=['data', 'crop_science'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
ROIFile = Filepath('CircularFields_AlfalfaROI.xml', $
Subdir=['data', 'crop_science'], $
Root_Dir=e.Root_Dir)
ROI = e.OpenROI(ROIFile)
maskedRaster = ENVIROIMaskRaster(Raster, ROI)
Task = ENVITask('AgSpectralHotspotAnalysis')
Task.INPUT_RASTER = maskedRaster
Task.INDEX = 'Modified Simple Ratio'
Task.DISTANCE = 10
Task.Execute
DataColl = e.Data
DataColl.Add, Task.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(Raster)
Layer2 = View.CreateLayer(Task.OUTPUT_RASTER)
View.Zoom, 0.75
Syntax
Result = ENVITask('AgSpectralHotspotAnalysis')
Input properties (Set, Get): INDEX, DISTANCE, INPUT_RASTER, OUTPUT_RASTER_URI
Output properties (Get only): 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:
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:
DISTANCE (required)
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.
INDEX (required)
Specify the spectral index on which to perform hotspot analysis. See SpectralIndex Task for a complete list of spectral indices. You can run QuerySpectralIndices Task to see what indices are available for your particular image.
INPUT_RASTER (required)
Specify a single-band input raster.
OUTPUT_RASTER
This is a reference to the output raster of filetype ENVI.
OUTPUT_RASTER_URI (optional)
Specify a string with the fully qualified filename and path of the associated OUTPUT_RASTER. If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.
Version History
Crop Science 1.0
|
Introduced |
See Also
AgHotspotAnalysis Task, AgHotspotColorSlice Task, ENVIAgCalculateGetisOrd, AgCalculateGetisOrd Task