AgFindDevelopingHotspotsWithSpectralIndex Task

This task computes a spectral index for two rasters of the same spatial extent, from different dates. It looks for anomalies between the rasters. The result is a classification image that shows statistically significant differences during the intervening time period. Areas that change at an average rate are suppressed, while areas that change at a higher rate (positive or negative) are highlighted. For agricultural studies, this can be useful for identifying areas that are growing faster or slower, relative to the entire image. Or, it can reveal areas that were damaged by events such as hail storms and drought.

You should spatially subset the Time 1 and Time 2 images to only include your area of interest, or mask out the rest of the images outside of the field extent. Then ensure that they are co-registered. See Example of Subsetting by ROI in the Find Hotspots topic for instructions.

This task requires a separate license for the ENVI Crop Science Module; contact your sales representative for more information.

Example

The source data used in this example is a time series of Sentinel-2A Level-1 images of Imperial Valley, California, in 2016. The source images were corrected for atmospheric effects using the ENVI QUick Atmospheric Correction (QUAC®) tool. A region of interest (ROI) was defined for a durum wheat field, and each image in the time series was spatially subsetted around this field. The images are located in the data\crop_science\trend_analysis folder of the ENVI installation path.

; Start the application

e = ENVI()

 

; Open a Sentinel-2 base image

file = Filepath('Sentinel2Subset_2016-12-12.dat', $

  Subdir=['data','crop_science','trend_analysis'], $

  Root_Dir = e.Root_Dir)

raster = e.OpenRaster(file)

 

; Open a Time 1 image of a durum wheat field

Time1File = Filepath('DurumWheat_2016-11-22.dat', $

  Subdir=['data','crop_science','trend_analysis'], $

  Root_Dir=e.Root_Dir)

Time1Raster = e.OpenRaster(Time1File)

 

; Open a Time 2 image of a durum wheat field

Time2File = Filepath('DurumWheat_2016-12-12.dat', $

  Subdir=['data','crop_science','trend_analysis'], $

  Root_Dir=e.Root_Dir)

Time2Raster = e.OpenRaster(Time2File)

 

; Get the task from the catalog of ENVITasks

Task = ENVITask('AgFindDevelopingHotspotsWithSpectralIndex')

 

; Define inputs

Task.INPUT_TIME1_RASTER = Time1Raster

Task.INPUT_TIME2_RASTER = Time2Raster

Task.INDEX = 'NDVI'

Task.DISTANCE = 10 ;meters

 

; Run the task

Task.Execute

 

; Get the collection of objects currently in the Data Manager

DataColl = e.Data

 

; Add the output to the data collection

DataColl.Add, Task.OUTPUT_RASTER

 

; Display the result

View = e.GetView()

Layer = View.CreateLayer(raster)

Layer2 = View.CreateLayer(Task.OUTPUT_RASTER)

View.Zoom, 2.0

Syntax

Result = ENVITask('AgFindDevelopingHotspotsWithSpectralIndex')

Input properties (Set, Get): DISTANCE, INDEX, INPUT_TIME1_RASTER, INPUT_TIME2_RASTER, OUTPUT_RASTER_URI, THRESHOLD

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 rasters have a valid spatial reference, then the radius is measured in meters. Otherwise, it is measured in pixels.

INDEX (required)

Specify a string indicating the spectral index from which to calculate crop metrics. See SpectralIndex Task for a complete list of spectral indices. You can also run QuerySpectralIndices Task to see what indices are available for your particular image.

INPUT_TIME1_RASTER(required)

Specify a raster at time 1.

INPUT_TIME2_RASTER (required)

Specify a raster of the same area at a later time.

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.

THRESHOLD (optional)

Specify the threshold for the first color slice. The default is 3.0 standard deviations. Lower values reveal more hotspots, while higher values reveal fewer hotspots.

Version History

Crop Science 1.1

Introduced

See Also

AgFindDevelopingHotspots Task, AgHotspotAnalysis Task, AgSpectralHotspotAnalysis Task, ENVIAgCalculateGetisOrd, AgCalculateGetisOrd Task