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 parameters (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, SPATIALREF, SUN_AZIMUTH, SUN_ELEVATION, TIMESTAMP, WAVELENGTH, WAVELENGTH_UNITS, Z_PLOT_RANGE, Z_PLOT_TITLES

Output parameters (Get only): OUTPUT_RASTER

Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.

Input Parameters


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 parameter 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 (optional)

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
  • x% linear (for example, 5% linear)
  • optimized 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 parameter. 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_URI (optional)

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

  • If you do not specify this parameter, or set it to an exclamation symbol (!), ENVI creates a temporary file.
  • If you set it to the hash symbol (#), ENVI creates a file in the temporary directory, but this file will not be deleted when ENVI closes.

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. Strings are case-sensitive.

AATSR

MASTER

ADAR

MERIS

ADEOS

MIVIS

ADRG

MODIS

Air Photo

MOMS-02

AIRSAR

NAXAR-LEGION

AISA

NIGERIASAT

ALOS

NIGERIASAT-2

ALSAT

NPP VIIRS

ALSAT-2A

OrbView-3

ALSAT-2B

PACE-OLI

ALSAT-1B

PeruSat

ASAR

PINEO-4

ASTER

PINEO-3

AVHRR

PlanetScope

AVIRIS

PLEIADES-1A

BEIJING

PLEIADES-1B

Capella

PRISMA

CARTOSAT-1

PROBA-V

CASI

QuickBird

COSMO-SkyMed

RADARSAT

DEIMOS-2

RADARSAT-2

DEIMOS-1

RapidEye

DMC

RASAT

DMSP

ResourceSat2 AWiFS

Dragonette

ResourceSat2 LISS-III

DUBAISAT-2

ResourceSat2 LISS-IV

DUBAISAT-1

Scanned Image

EnMAP

SEAWIFS

EO-1 ALI

SEBASS

EO-1 Hyperion

Sentinel-3

EROS

Sentinel-2

ERS

Sentinel-2A

FORMOSAT-2

Sentinel-2B

FormoSat-5

Sentinel-1

GeoEye-1

SIR-C

GEOSCAN

SkySat-1

GER63

SPIN-2

GF-2

SPOT

GF-1

SPOT-7

GOES-16

SPOT-6

GOES-R

SSOT

GOKTURK-2

STRM

Goturk-1

SuperView-1

GRUS

TerrSAR-X

Himawari-9

THEOS-2

Himawari-8

TIMS

HYDICE

TMS

HyMap

TRWIS III

Hyperion

UK-DMC

ICEYE

UK DMC2

IKONOS

Umbra

IRS LISSIII

Unknown

IRS Pan

UrtheCastTheia

IRS WIFS

USGS DEM

JERS-1

VNREDSAT-1

Julin-1

WorldView-2

KOMPSAT-3

WorldView-1

KOMPSAT-2

WORLDVIEW-4

Landsat ETM

WORLDVIEW-3

Landsat ETM+

X-SAR

Landsat MSS

ZhulHai-1

Landsat OLI

ZY3-1

Landsat OLI-2

ZY-1-02C

Landsat TIR

ZY-1-02D

Landsat TIRS-2

ZY1E

Landsat TM

 

LeicaADS

 

MAS

 

SOLAR_IRRADIANCE (optional)

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

SPATIALREF (optional)

Specifies a spatial reference for the raster.

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.

TIMESTAMP (optional)

The Temporal Cube timestamp.

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 parameter 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 parameter. The default value is Nanometers.

  • GHz
  • Index
  • MHz
  • Micrometers
  • Nanometers
  • Wavenumber
  • 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.

Output Parameters


OUTPUT_RASTER

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

Methods


Execute

Parameter

ParameterNames

Properties


DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History


ENVI 5.5

Introduced

ENVI 5.7

Added the COLOR_TABLE parameter

ENVI 6.2 Added the SPATIALREF parameter

See Also


ENVITask, SetRasterMetadata Task, RasterMetadataItem Task, ENVISubsetRaster, ENVIRasterMetadata, ENVIRaster::WriteMetadata, ENVIRaster::Save, Raster Metadata