This task sets specific metadata values for an input raster and produces a new raster with the edited metadata. Metadata items that are not set with the task will remain intact.

Example


; Start the application
e = ENVI(/HEADLESS)
 
; Open an input file
File = Filepath('qb_boulder_msi', Subdir=['data'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('EditRasterMetadata')
 
; Define metadata overrides / additions
Task.INPUT_RASTER = Raster
Task._DESCRIPTION = 'My description override'
Task.BAND_NAMES = ['b1', 'b2', 'b3', 'b4']
 
; Add custom metadata
Task.CUSTOM_METADATA = Hash('My tag', 'My tag value')
 
; Run the task
Task.Execute
 
; Verify new metadata
Print, Task.OUTPUT_RASTER.METADATA['description']
Print, Task.OUTPUT_RASTER.METADATA['band names']
Print, Task.OUTPUT_RASTER.METADATA['My tag']

Syntax


Result = ENVITask('EditRasterMetadata')

Input properties (Set, Get): ACQUISITION_TIME, BAND_NAMES, BBL, CLASS_LOOKUP, CLASS_NAMES, CLASSES, CLOUD_COVER, COLOR_TABLE, CUSTOM_METADATA, DATA_GAIN_VALUES, DATA_IGNORE_VALUE, DATA_OFFSET_VALUES, DATA_REFLECTANCE_GAIN_VALUES, DATA_REFLECTANCE_OFFSET_VALUES, DEFAULT_BANDS, DEFAULT_STRETCH, DEM_BAND, DEM_FILE, _DESCRIPTION, FWHM, INPUT_RASTER, OUTPUT_RASTER_URI, REFLECTANCE_SCALE_FACTOR, SECURITY_TAG, SENSOR_TYPE, SOLAR_IRRADIANCE, SUN_AZIMUTH, SUN_ELEVATION, WAVELENGTH, WAVELENGTH_UNITS, Z_PLOT_RANGE, Z_PLOT_TITLES

Output properties (Get only): OUTPUT_RASTER

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:

AddParameter

Execute

Parameter

ParameterNames

RemoveParameter

Properties


This task inherits the following properties from ENVITask:

COMMUTE_ON_DOWNSAMPLE

COMMUTE_ON_SUBSET

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

This task also contains the following properties:

ACQUISITION_TIME (optional)

Specify a string with the acquisition time, conforming to the ISO-8601 standard. The string can be in any of the following formats:

YYYY-MM-DD
YYYY-MM-DDTHH:MM:SS.DZ
YYYY-MM-DDTHH:MM:SS:Dooo:mm

Where:

  • YYYY is the four-digit year
  • MM is the two-digit month
  • DD is the two-digit day
  • T separates the date and time
  • HH is the two-digit hour
  • MM is the two-digit minute
  • SS is the two-digit second
  • D is the decimal fraction of a second with up to double-precision
  • Z indicates that the time is in Coordinate Universal Time (UTC)
  • ooo is a two-digit offset in hours from UTC time. If the offset is negative, a minus symbol (-) precedes the value.
  • mm is an optional partial-hour offset (in minutes) from UTC time.

BAND_NAMES (optional)

Specify a string array with the names of raster bands.

BBL (optional)

Specify an integer array with the same number of elements as BAND_NAMES, where 0 indicates a bad band and 1 indicates a good band. This property is typically used with hyperspectral imagery.

CLASS_LOOKUP (optional)

Specify a (3, n) byte array, where n is the number of classes, with RGB color definitions for each class in a classification file. For example, black is [0,0,0].

CLASS_NAMES (optional)

Specify a string array of class names in a classification file, where the number of elements must equal the number of classes.

CLASSES (optional)

Specify an unsigned integer value with the number of classes (including unclassified regions) in a classification file.

CLOUD_COVER (optional)

Specify a floating-point value (0 to 100.0) with the percentage of cloud cover within the raster.

COLOR_TABLE (optional)

Specify a (3, 256) byte array representing the full color table to use when displaying this raster.

CUSTOM_METADATA

Specify a hash of key-value pairs indicating user-defined custom metadata items not defined in the ENVI header file format. The key of the hash will be the name of the metadata item, its value (string) will become the metadata value.

DATA_GAIN_VALUES (optional)

Specify a double-precision array of gain values for each band. Units are W/(m2 * µm * sr).

DATA_IGNORE_VALUE (optional)

Specify an integer indicating the pixel value that should be ignored in image processing.

DATA_OFFSET_VALUES (optional)

Specify a double-precision array of offset values for each band.

DATA_REFLECTANCE_GAIN_VALUES (optional)

Specify a double-precision array of reflectance gain values.

DATA_REFLECTANCE_OFFSET_VALUES (optional)

Specify a double-precision array of reflectance offset values.

DEFAULT_BANDS (optional)

Specify an unsigned integer array of band numbers to automatically load into the current view every time the raster is opened.

DEFAULT_STRETCH (optional)

Specify one of the following strings indicating the stretch to apply when ENVI display the raster:

equalization
gaussian
linear range
logarithmic
optimized linear
x % linear (for example, 5% linear)
square root

DEM_BAND (optional)

Specify an unsigned integer indicating the index (starting at 1) of a selected DEM band associated with the raster, as indicated by the DEM_FILE property. If the DEM file contains a single band, or if you choose the first band of the input raster, the DEM_BAND value defaults to 0.

DEM_FILE (optional)

Specify a string with the fully qualified path and filename of a DEM associated with the raster.

_DESCRIPTION (optional)

Specify a string that describes the image or the processing performed.

FWHM (optional)

Specify a double-precision array of full-width-half-maximum (FWHM) values of each band in the raster.

INPUT_RASTER (required)

Specify a raster on which to set the metadata values.

OUTPUT_RASTER (optional)

Updating the header file requires closing the raster. Use this property to reopen and return a reference to the raster.

OUTPUT_RASTER_URI (optional)

Specify a string with the fully qualified filename and path to export the associated OUTPUT_RASTER.

  • If you set this property to an asterisk symbol (*), the output raster will be virtual and not written to disk.
  • If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.

REFLECTANCE_SCALE_FACTOR (optional)

Specify a floating-point value that, when divided into the pixel data, would scale it from 0-1 reflectance. For example, if the value of 10,000 in the pixel data represents a reflectance value of 1.0, enter a reflectance scale factor of 10,000.

SECURITY_TAG (optional)

Specify a string with security information inherited from formats that typically contain security classification levels (such as NITF).

SENSOR_TYPE (optional)

Specify a string indicating the sensor type of the input raster. To retrieve the full list of supported sensors, use the ENVIParameterENVISensorName::GetSensorList method.

SOLAR_IRRADIANCE (optional)

Specify a double-precision array of top-of-atmosphere solar irradiance values per band. Units are W/(m2 * µm).

SUN_AZIMUTH (optional)

Specify a double-precision value with the angle of the sun (in degrees) from due north in a clockwise direction.

SUN_ELEVATION (optional)

Specify a double-precision value with the angle of the sun (in degrees) above the horizon.

WAVELENGTH (optional)

Specify a double-precision array that lists the center wavelength values of each band in an image. Units should be the same as those used for the FWHM property and also set in the WAVELENGTH_UNITS parameter.

WAVELENGTH_UNITS (optional)

Specify one of the following strings indicating the units of the wavelengths in the WAVELENGTH property. The default value is Nanometers.

Micrometers
Nanometers
Wavenumber
GHz
MHz
Index
Unknown

Z_PLOT_RANGE (optional)

Specify a two-element double-precision array with the default minimum and maximum values for Z (spectral) plots.

Z_PLOT_TITLES (optional)

Specify a two-element string array with the X-axis and Y-axis titles for Z (spectral) plots.

Version History


ENVI 5.5

Introduced

ENVI 5.7 Added the COLOR_TABLE property.

API Version


4.2

See Also


ENVITask, SetRasterMetadata task, ENVISubsetRaster, ENVIRasterMetadata, ENVIRaster::WriteMetadata, ENVIRaster::Save, Raster Metadata (ENV API Programming), ENVIParameterENVISensorName::GetSensorList