This function constructs an ENVIRaster from a source raster where values above a threshold are set to the threshold.
The result is a virtual raster, which has some additional considerations with regard to methods and properties. See Virtual Rasters for more information, including how they differ from ENVITasks.
The equivalent task is HighClipRaster.
Example
In this example:
- Pixel values greater than or equal to 250.0 in Band 1 are set to 250.0
- Pixel values greater than or equal to 360.0 in Band 2 are set to 360.0
- Pixel values greater than or equal to 270.0 in Band 3 are set to 270.0
- Pixel values greater than or equal to 360.0 in Band 4 are set to 360.0
e = ENVI()
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
threshold = [250., 360., 270., 360.]
highClipRaster = ENVIHighClipRaster(raster, threshold)
newFile = e.GetTemporaryFilename()
highClipRaster.Export, newFile, 'ENVI'
highClipRaster = e.OpenRaster(newFile)
View = e.GetView()
Layer = View.CreateLayer(highClipRaster)
See More Examples below.
Syntax
Result = ENVIHighClipRaster(Input_Raster, Threshold, ERROR=variable)
Return Value
This routine returns a reference to an ENVIRaster.
Arguments
Input_Raster
Specify the input ENVIRaster.
Threshold
Specify an array of threshold values (one per band). If the source raster only has one band, specify an array with one element.
Methods
This virtual raster inherits methods and properties from ENVIRaster; however the following methods will override the ENVIRaster methods:
Dehydrate
Hydrate
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.
NAME
Specify a string that identifies the raster.
More Examples
The following example constrains an image to within 3 standard deviations around its mean. About 99.7% of the values fall within this range for a variable with a normal distribution. Even for non-normally distributed variables, typically at least 98% of the values will fall within the three-sigma interval.
This example wraps ENVILowClipRaster around the results of ENVIHighClipRaster:
e = ENVI()
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
stats = ENVIRasterStatistics(raster)
maxThreshold = stats.MEAN+(3.0*stats.STDDEV)
minThreshold = stats.MEAN-(3.0*stats.STDDEV)
rasterHighClip = ENVIHighClipRaster(raster, maxThreshold)
rasterClipped = ENVILowClipRaster(rasterHighClip, minThreshold)
View = e.GetView()
Layer = View.CreateLayer(rasterClipped)
Version History
ENVI 5.3 |
Introduced |
ENVI 5.3.1 |
Documented the dehydrated form of this virtual raster
|
ENVI 5.4 |
Added Dehydrate and Hydrate methods; added NAME keyword
|
API Version
4.3
See Also
ENVIRaster, HighClipRaster Task, ENVILowClipRaster, LowClipRaster Task