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 / ENVIAgCalculateCropMetricsTask

ENVIAgCalculateCropMetricsTask

ENVIAgCalculateCropMetricsTask

This task calculates statistics from a raster and an associated ENVIAgCrops object. For example, if the input raster is a vegetation index such as NDVI, the crop metrics describe the health of the crops. You can run ENVIAgCropCountTask or ENVIAgCountAndRasterizeCropsTask to create an ENVIAgCrops object before running ENVIAgCalculateCropMetricsTask. Or, you can use an ENVIAgCrops file that you created and saved earlier.

To create a raster that you can visualize from crop metrics, use ENVIAgCalculateAndRasterizeCropMetricsTask or ENVIAgCalculateAndRasterizeCropMetricsWithSpectralIndexTask.

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

Example


This example performs the following steps:

  1. Opens an orthophoto of a citrus orchard.
  2. Creates a spectral index raster to make the citrus trees bright against the background. A Normalized Difference Vegetation Index (NDVI) works well in this case.
  3. Tip: See the ENVISpectralIndexRaster topic in ENVI Help for a full list of spectral indices. You can run ENVIQuerySpectralIndicesTask to see what indices are available for your particular image.

  4. Runs ENVIAgCropCount to count the trees and to create an ENVIAgCrops object.
  5. Runs ENVIAgCalculateCropMetricsTask to calculate metrics from the NDVI image.
  6. Prints the NDVI metrics.
; Start the application
e = ENVI(/HEADLESS)
 
; Open an input file
File = Filepath('CitrusOrthophoto.dat', $
  Subdir=['data','crop_science'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Preprocess the image so that crops are bright.
NDVIImage = ENVISpectralIndexRaster(Raster, 'NDVI')
 
; Count the crops and output an ENVIAgCrops object
outCrops = ENVIAgCropCount(NDVIImage, 2.0, 5.0, $
  GAUSSIAN_FACTOR = 0, $
  /INCLUDE_EDGES, $
  INTENSITY_THRESHOLD = 0.8, $
  NUMBER_OF_INCREMENTS = 4, $
  PERCENT_OVERLAP = 100.0)
 
; Run the crop metrics task
Task = ENVITask('AgCalculateCropMetrics')
Task.INPUT_CROPS = outCrops
Task.INPUT_RASTER = NDVIImage
Task.Execute
 
; Print the crop metrics
outCropMetrics = Task.OUTPUT_CROPS
Print, outCropMetrics

Syntax


Result = ENVITask('AgCalculateCropMetrics')

Input properties (Set, Get): INPUT_CROPS, INPUT_RASTER, OUTPUT_CROPS_URI

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

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_CROPS (required)

Specify an input ENVIAgCrops object. You can run ENVIAgCropCountTask or ENVIAgCountAndRasterizeCropsTask to create an ENVIAgCrops object before running ENVIAgCalculateCropMetricsTask. Or, you can use an ENVIAgCrops file that you created and saved earlier.

INPUT_RASTER (required)

Specify a single-band input raster. With multispectral images, you must first create a single-band spectral subset.

NAME

This property contains the name of the task.

OUTPUT_CROPS

This is a reference to the output crop data, which contains extra properties (with statistics) in addition to the standard ENVIAgCrops properties:

  • CROP_MAX: The maximum pixel value for each crop
  • CROP_MEAN: The mean pixel value for each crop
  • CROP_MIN: The minimum pixel value for each crop
  • CROP_STDDEV: The standard deviation pixel value for each crop

OUTPUT_CROPS_URI (optional)

Specify a string with the fully qualified path and filename for OUTPUT_CROPS. If you do not specify this property, the output crop file is only temporary. Once the crop file has no remaining references, ENVI deletes the temporary file.

Version History


1.0

Introduced

See Also


ENVIAgCrops, ENVIAgCropCountTask



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