Use the Hydrate static function method to create the object from its dehydrated form. The dehydrated form consists of a hash containing the object’s properties and values. The Hydrate and Dehydrate methods let you store the object state in memory and restore it later.
Representing an object as a hash is necessary for running ENVI analytics with the ENVI Task Engine.
See the ENVIHydrate function if you are creating a general IDL routine that will restore multiple object types.
For additional information, see What are Hydrate and Dehydrate routines used for?
Example
e = ENVI(/HEADLESS)
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
dehydratedForm = raster.Dehydrate()
raster.close
newRaster = ENVIRaster.Hydrate(dehydratedForm)
Print, newRaster, /IMPLIED_PRINT
Syntax
Result = ENVIRaster.Hydrate(DehydratedForm, ERROR=value)
Return Value
The result is a reference to a new object instance of this virtual raster class.
Arguments
DehydratedForm
Key |
Description |
factory |
Required. A string value of URLRaster indicating what object type the hash represents.
|
auxiliary_url |
A string array containing the URLs for any auxiliary files associated with the raster file. This key is generated on output if auxiliary files exist. On input this key is ignored to allow ENVIURLRaster to override various behaviors. |
data_ignore_value
|
A scalar numeric value that masks out any pixels matching the value. Example:
"data_ignore_value" : -9999
|
dataset_index |
A scalar integer value that is the zero-based index of the raster to load from a container format consisting of multiple rasters. Example:
"dataset_index" : 1
|
dataset_name |
A case-sensitive scalar string that identifies which raster to load from a container format consisting of multiple rasters. Example:
"dataset_name" : "cirrus"
|
format |
A scalar string that specifies the format of the raster. Known native values will be ignored, known external formats will force the loading of the raster according to the given format, and unknown formats will be treated as the name of the custom read procedure. Example:
"format" : "alos"
|
interleave |
A case-insensitive string used in conjuction with dataset_name to indicate how to interpret 3D pixel arrays. Specify bsq, bil, or bip. If not specified, then bsq is the default. Example:
"interleave" : "bip"
|
metadata_override
|
The hash representation of an ENVIRasterMetadata object. Example:
"metadata_override" : {
"factory": "RasterMetadata",
"WAVELENGTH": [485.00000000000000, 560.00000000000000, 660.00000000000000, 830.00000000000000],
"WAVELENGTH UNITS": "Nanometers",
"SENSOR TYPE": "QuickBird",
"BAND NAMES": ["Band 1", "Band 2", "Band 3", "Band 4"]
}
|
password |
A scalar string to use when opening a remote dataset that requires authentication. For security reasons, this is not included in the hash returned from the Dehydrate method, but you can manually add it before the hash is passed into ENVIHydrate.
|
prompt_user |
A Boolean value that instructs the system to prompt the user with interactive dialogs when opening the raster. This is not included in the hash returned from the Dehydrate method since it is not compatible with batch-mode processing, but you can manually add it before the hash is passed into ENVIHydrate.
|
spatialref_override
|
The hash representation of a spatial reference of type ENVIStandardRasterSpatialRef, ENVIPseudoRasterSpatialRef or ENVIRPCRasterSpatialRef. Example:
"spatialref_override" : {
"factory": "StandardRasterSpatialRef",
"rotation": 0.00000000,
"tie_point_pixel": [0.00000000, 0.00000000],
"coord_sys_code": 32611,
"pixel_size": [30.000000, 30.000000],
"tie_point_map": [493785.00, 4899315.0]
}
|
template |
Scalar string with the name of a custom XML file to use when opening a HDF5 file. Example:
"template" : "/usr/local/INSTALL_DIR/envi/data/my_template.xml"
|
time_override |
The hash representation of an ENVITime object. Example:
"time_override" : {
"acquisition": "2015-10-30T16:05:32.3258314Z",
"factory": "Time"
}
|
url |
Required. A scalar string with the local filename or URI to a remote data source. Example:
"url" : "/usr/local/INSTALL_DIR/envi/data/qb_boulder_msi"
|
username |
A scalar string to use when opening a remote dataset that requires authentication. For security reasons, this is not included in the hash returned from the Dehydrate method, but you can manually add it before the hash is passed into ENVIHydrate.
|
uvalue |
Any data type is allowed. This key is used when format is not a known native or external type but specifies a custom read procedure. The uvalue is passed into that procedure's UVALUE keyword, if it exists. Example:
"uvalue" : 3.14159
|
Keywords
ERROR
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.
Version History
API Version
4.3
See Also
ENVIRaster, ENVIRaster::Dehydrate, ENVIHydratable, ENVIHydrate