ENVICastRaster

This function creates an ENVIRaster from a source raster where pixel values have been cast to a specified data type; for example, unsigned integer or double-precision floating point.

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 CastRaster.

Example

; Start the application

e = ENVI()

 

; Open an input file

file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $

SUBDIRECTORY = ['data'])

raster = e.OpenRaster(file)

 

; Cast the raster to floating point values

castRaster = ENVICastRaster(raster, 'float')

 

; Display the result

View = e.GetView()

Layer = View.CreateLayer(castRaster)

Syntax

Result = ENVICastRaster(Input_Raster, Data_Type [, Keywords=value])

Return Value

This function returns a reference to an ENVIRaster.

Arguments

Input_Raster

Specify an input ENVIRaster.

Data_Type

Specify a string indicating the data type to cast the pixel values to. Choose one of the following values, which are supported by any ENVIRaster:

Note: Casting a floating-point raster to integer will truncate the data values. Overflow will occur when the original value is greater than the maximum value for the output data type.

Methods

Dehydrate

Hydrate

Keywords

DATA_IGNORE_VALUE (optional)

Set this keyword to a numeric pixel value that will be ignored upon export. The pixel state of the output raster will be the same as that of the input raster, regardless of whether or not it was set. The data ignore value should be different from any other pixel value in the input raster, in order to avoid masking out good pixels during export.

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.

Version History

ENVI 5.4.1

Introduced

API Version

4.2

See Also

ENVIRaster, CastRaster Task