This is a reference to an ENVIAgCrops object, which specifies the locations and radii of crop centers found in a raster.
This object requires a separate license for the ENVI Crop Science Module; contact your sales representative for more information.
Example
e = ENVI(/HEADLESS)
File = Filepath('Cotton.dat', $
SUBDIR=['data','crop_science'], $
ROOT_DIR=e.Root_Dir)
Raster = e.OpenRaster(File)
subset = ENVISubsetRaster(Raster, BANDS=[1])
outCrops = ENVIAgCropCount(subset, 9, 12, $
GAUSSIAN_FACTOR=0.8, $
/INCLUDE_EDGES, $
INTENSITY_THRESHOLD=0.81, $
NUMBER_OF_INCREMENTS=12, $
OUTPUT_NCROPS=outputNumCrops, $
PERCENT_OVERLAP=60)
Print, outCrops, /IMPLIED
Syntax
Result = ENVIAgCrops(URI=value [, ERROR=value])
Or:
Result = ENVIAgCrops(RADIUS=value, XYLOCATION=value, NROWS=value, NCOLUMNS=value [, ACQUISITION_TIME=value] [, ATTRIBUTES=value] [, BAND_NAME=value] [, CROP_ROW=value] [, SPATIALREF=value] [, XSTART=value] [, YSTART=value] [, ERROR=value])
Arguments
None
Methods
Dehydrate
Export
Hydrate
Remove
Properties
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.
ACQUISITION_TIME (Init, Get)
The acquisition time of the input raster from which crops were derived. You can also set a different string value for acquisition time when initializing the ENVIAgCrops object.
ATTRIBUTES (Init, Get)
A hash containing user-defined crop attributes. You can add custom attributes (properties) to an ENVIAgCrops object; for example, a description or an array of ancillary data. Initialize the object as follows:
crops = ENVIAgCrops(SPATIALREF=spatialRef, $
XYLOCATION=locations, RADIUS=radius, $
NROWS=nrows, NCOLUMNS=nrows, $
MY_DESCRIPTION='text string', MY_DATA=intarr(x))
BAND_NAME (Init, Get)
The band name of the input raster from which crops were derived. You can also set a different string value for the band name when initializing the ENVIAgCrops object.
CROP_ROW (Init, Get)
A list of arrays, where each array is a row. The numbers in each array are zero-based crop indices. This property is generated by the ENVIAgFindRows procedure.
NCOLUMNS (Init, Get)
The number of columns in the input raster from which crops were derived.
NCROPS (Get)
The number of crops, based on the number of array elements in RADIUS and XYLOCATION.
NROWS (Init, Get)
The number of rows in the input raster from which crops were derived.
RADIUS (Init, Get)
An n-element array of crop radii corresponding to the locations specified by XYLOCATION. Values are in meters if a spatial reference is specified; otherwise, it is the number of pixels.
SPATIALREF (Init, Get)
An ENVIStandardRasterSpatialRef object that specifies the spatial reference of the input raster from which crops were derived.
URI (Init, Get)
A fully qualified filename and path to an ENVIAgCrops object.
- If you create (initialize) a new ENVIAgCrops object, you can choose whether or not to specify a preferred URI. However, if you call the Export method to save the object without specifying a URI, you will receive an error message.
- Use the Export method to save the ENVIAgCrops object to that URI. If you call the Export method and specify a different filename using that method's URI keyword, a separate file will be created.
- You can specify a URI to a previously saved ENVIAgCrops file (.json). This file is typically created with ENVIAgCropCount or AgCropCount Task; for example:
crops = ENVIAgCrops(URI='PreviouslySavedCrops.json')
In this case, setting keywords will overwrite the ENVIAgCrops object with the changes you specify; for example:
crops = ENVIAgCrops(URI='PreviouslySavedCrops.json', SPATIALREF = newSpatialRef)
The spatial reference will be different, while all other properties remain the same. The crop file itself will not be overwritten until you call the Export method again.
XSTART (Init, Get)
The image X coordinate for the upper-left pixel in the input raster from which crops were derived. The default value is 0.
XYLOCATION (Init, Get)
A [2, n] array of x,y file coordinates of crop centers in the input raster from which crops were derived.
YSTART (Init, Get)
The image Y coordinate for the upper-left pixel in the input raster from which crops were derived. The default value is 0.
Keywords
Specify the URI keyword pointing to a previously saved crops file (.json). Or, specify a combination of all other keywords, where NCOLUMNS, NROWS, RADIUS, and XYLOCATION are required.
ATTRIBUTES (optional)
Set this keyword to a hash containing user-defined crop attributes. The hash is not case-sensitive.
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.
NCOLUMNS (required)
Set this keyword to the number of columns in the raster from which crops were derived.
NROWS (required)
Set this keyword to the number of rows in the input raster from which crops were derived.
RADIUS (required)
Set this keyword to an n-element array of crop radii corresponding to the locations specified by XYLOCATION. Values are in meters if a spatial reference is specified; otherwise, it is the number of pixels.
SPATIALREF (optional)
Set this keyword to an ENVIStandardRasterSpatialRef object that specifies the spatial reference of the input raster from which crops were derived.
URI (optional)
Set this keyword to a fully qualified URI with the path and filename of a previously saved ENVIAgCrops file (.json). This file is typically created with ENVIAgCropCount or AgCropCount Task. Or, set it to a new path and filename.
XYLOCATION (required)
Set this keyword to a [2, n] array of x,y file coordinates of crop centers in the input raster from which the crops were derived.
Version History
Crop Science 1.0
|
Introduced |
Crop Science 1.0.1
|
Added CROP_ROW property
|
See Also
ENVIAgCropCount, AgCropCount Task, AgCountAndRasterizeCrops Task, ENVIAgCalculateCropMetrics,AgCalculateCropMetrics Task, AgCalculateAndRasterizeCropMetrics Task, AgCalculateAndRasterizeCropMetricsWithSpectralIndex Task